Usage of the Refetch component in Jira Cloud Automation rule
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
To ensure your automation rules always use the most current work item data, use the "Refetch work item" component.
Diagnosis
When a work item is updated mid-rule, for example, by an "Edit work item" step, subsequent steps may not reflect those changes. The "Refetch work item" component retrieves the latest work item data, ensuring all actions based on that data are accurate and up-to-date.
Cause
Automation caches the state of a work item at the start of the rule execution. Therefore, even when the work item is updated during the process of rule execution the state remains the same throughout the execution of the rule.
Solution
After using the Edit work item action for the first time, use the "Refetch" action component right before the step where you would like the second action to be performed on the same work item. In the below example, we only use the Edit work item action for the demo, but the Refetch component can be used before any Action (or) Condition components to get the latest state of the work item. This can also be used inside Branches.
Example: Let's assume you have an automation rule with a Work item Created trigger and two Edit work item actions. Both of these actions edit the number field name "QL."
The first Edit work item action increases the QL field by 3.
The second Edit work item action increases the QL field by 1.
Now, when you create a work item with QL value zero and the rule runs, the first Edit work item action increases the QL by 3, and the second Edit work item action increases the QL value again by 1.
The total values should be 4, but if you check the QL field, you will see the value is only set to 1.
This is because the work item's state has not been refreshed since the start of the rule execution.
Now, we add the "Refetch" component before the second Edit work item action and trigger the rule again.
Create a new work item with the QL value 0. When the rule runs, the QL value is updated to 4.
Was this helpful?