Automation Rule to remove worklog

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

Setup an automation rule that can allow removing their work log on an issue by a respective user by putting 0 in the custom field(Number Type) from the respective issue.

Environment

Jira Cloud

Solution:

Here is the suggestion:
The components used in the rule are the following:

  • Trigger - When value changes (Trigger the automation rule when the required number customer field is altered for all issue operations.)
  • Condition - Issue fields conditions (Check that the custom field is equal to 0)
  • Action - Send web request (Get all work logs attached to the issue - GET /rest/api/3/issue/{issueIdOrKey}/worklog/)
  • Advanced branch - For each smart value (Iterate through the list of work logs, detecting the author and deleting if the display name is the same as the initiator of the rule.)
    {{webResponse.body.worklogs.id}} 
    • Action - Send web request  (Get the individual worklog details - GET /rest/api/3/issue/{issueIdOrKey}/worklog/{id})
    • Condition - Advanced compare condition (Check that the Initiator of the rule and the display name on this specific work log are the same.)
    • Action - Send web request ( Delete the individual work log record if the above condition is met - DELETE /rest/api/3/issue/{issueIdOrKey}/worklog/{id})

Note: At all times, it is vital as an administrator to ensure that deleting objects conforms with your organization's policy. 

Last modified on Jan 30, 2025

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.