Usage of the Refetch component in an Automation rule

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

Summary

When you are updating an issue in an automation rule using an Edit issue step and trying to fetch the same issue data in a later step, you may not see the updated data from the prior steps. This is where we use the "Refetch" component to fetch the latest issue data in the midst of rule execution.

Diagnosis

NA

Cause

Automation caches the state of an issue at the start of the rule execution. Hence, even when the issue is updated during the process of rule execution the state remains the same throughout the execution of the rule.

Solution

After using the Edit issue 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 issue. In the below example, we only use the Edit issue action for the demo, but the Refetch component can be used before any Action (or) Condition components to get the latest state of the issue. This can also be used inside Branches.

Example: Let's assume you have an automation rule with an Issue Created trigger and then two Edit issue actions where both edit the number field name "QL".

  • The first Edit issue action increases the QL field by 3

First edit issue action
  • The second Edit issue action increases the QL field by 1

Second edit issue action
  • Now, when you create an issue with QL value 0 and the rule runs, the first Edit issue action increases the QL by 3 and the second Edit issue action increases the QL value again by 1.

  • So 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 state of the issue hasn't been refreshed from the start of the rule execution.

  • Now, we add the "Refetch" component before the second Edit issue action and trigger the rule again.

Refetch action
  • Create a new issue with the QL value 0 and once the rule runs we are able to see the QL value is updated to 4.

Updated on May 31, 2024

Still need help?

The Atlassian Community is here for you.