Retrieving past status of issue from automation

Carlos Piña López
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 24, 2025

Hi, I was wondering if it's possible to retrieve the status of an issue prior to the current one in an automation.  I currently have the following two automations:

  1. Manually triggered automation that clones an issue and changes its status to "Done".
  2. Automation triggered after issue creation very similar to this one, which copies the comments of the original issue into the cloned one.

What I need to do is to transition the cloned issue to the status of the original issue before being "Done".  I thought maybe I could retrieve it with the lookup issues and smart values, perhaps with something like "lookupIssues.last.changelog.status.fromString" or something along those lines, but I couldn't get anything I tried to work (possibly because the status of the original issue is already "Done" when the second automation is executed, I'm not entirely sure).

Do you have any idea if this is even possible?  I'm relatively new to Jira, but I'll try to provide additional information if needed.

Thanks in advance and hope to hear from you soon.

2 answers

2 accepted

6 votes
Answer accepted
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2025

Hi @Carlos Piña López -- Welcome to the Atlassian Community!

First thing: what problem are you trying to solve by transitioning the cloned issue to the prior status of the original?  That is, "why do this?"  Knowing that will help the community to offer better suggestions.

Until we know that...

There are several ways to do what you ask, including:

  • use another rule triggered on issue transition to "Done" which saves the prior status in a custom field, and use that custom field to transition the cloned issue
  • when the issue is cloned, use the REST API to read the changelog of the original issue to find the prior status and then transition the clone to it

Before trying either of those, check if the workflow for the issue type allows transitions to from the first one to any possible status and if there are any transition conditions.  Those will be needed for the rule transitions to succeed.

Kind regards,
Bill

Carlos Piña López
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 24, 2025

Hi, Bill, thanks for the warm welcome.

As Vijay and you pointed out, the easiest solution would be using custom fields.  I explained in my response to Vijay that I don't have permissions to create custom fields, but I managed to achieve my goal by storing the status as a label instead (this is only as a proof of concept).  Apparently it was way easier than I thought.

Thank you both for your answers and have a nice day.

2 votes
Answer accepted
Vijay Dadi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2025

Hello,

I would suggest having one custom field and have one automation with a trigger when issue is trigged.

Have edit issue step and copy the current status name to custom field. please try n see if it helps!

Thanks

Vj

Carlos Piña López
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 24, 2025

Hi, Vijay.

Thanks for your answer.  Unfortunately I don't have permission to create custom fields in the project, but I managed to achieve my objective by using labels as a proof of concept.  Here's an explanation if it can help someone in the future:

  1. In the first automation, I added the status id of the original issue as a label (ideally it would be a custom field, but this works for now) before changing it to "Done".
  2. In the second automation, I stored said label in a variable (with the smart value "lookupIssues.last.labels", given that there's only one label) and transitioned the issue to said value.

This seems to work fine as long as there are no more labels, but I'll try to get permissions and implement this solution with a custom field, it shouldn't be too different.

Thanks again for your time and have a nice day.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events