Transition work item to previous status using automation for Jira
Platform Notice: Cloud and Data Center - This article applies equally to both cloud and data center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
There can be cases where you'd like to transition a work item back to its most recent previous status. Automation can be used to extract the previous status of a work item for this purpose.
This is a possible workaround for AUTO-473.
Environment
Jira Cloud, Jira Software DC 9.12 and later.
Solution
Create custom fields to store previous status information
To transition to a previous status, you'll first have to capture previous status details in a custom field. This can be used later to transition the work item. We'll need two fields:
One text field to store the status name
This can be later used to display the previous status name on the screen if required
One text field to store the status ID
This would be required while transitioning the work item to a previous status
Create an automation rule to capture the previous status details
Use the Trigger: Field value changed: for the Status field
Add the Action: Edit work item
Set old status name field to
{{fieldChange.fromString}}
Set old status ID field to
{{fieldChange.from}}
Save this rule
Create an automation rule to transition to previous status
Use any trigger based on your requirements
Add the action: Transition work item
Destination status:
{{issue.
old status ID
}}
Save and run the rule
Please note:
Use the status ID and not status name while transitioning
If you use edit work item and transition work item in the same rule, add the Re-fetch work item data action as well
Was this helpful?