how to assign an issue based on information gathered from the history

Antonio Calì
Contributor
December 23, 2021

I would like to assign an issue based on information gathered from the history when there was a state transition (in the past).

For example, in the issue history I see:

 

Mr White changed the Status 3 days ago

STATUS 1 > STATUS 2.

 

Today the issue is in STATUS 5 and through a rule I’d like to assign the issue to Mr White and also move issue in STATUS 1

Mr White is not a reporter

Mr White is not an assignee

Can you give me support to implement the automation?

 

3 answers

1 accepted

2 votes
Answer accepted
Mykenna Cepek
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.
December 23, 2021

Hi @Antonio Calì and welcome to the Atlassian Community. Your question was an interesting challenge, and I enjoyed learning more about Automation while looking into it.

The solution below works in Jira Cloud.

I was able to pull the changelog for an issue in Jira, locate a user who made a change, and use that information to reassign the issue -- all within Jira Automation.

You can certainly do this kind of thing from the Jira API itself (or with the help of Jira apps). But I like to keep things in standard Jira Automation, if possible.

Here is an overview of my test rule, focusing in on the key magic to pull out the accountId for a user (arbitrarily the user who made the first/oldest change, just to keep things simple):

 

Changelog Assign 1.png

 

Tip: you can inspect the {{webResponse}} object after the "Send web request" action, in order to understand the data that is being returned. Use the "Log action"component, or even send it as an email or Slack/Teams message to yourself.

Learn more about iterating lists and accessing nested data here

And here is the audit log for this rule after 2 runs, showing successful reassignment during the first run:

 

Changelog Assign 2.png

I'll leave the remaining logic to you. It's not clear to me how you plan to identify the user who should be assigned to this issue, based on the data in the changelog. But all the information is there.

Note that, at this time, using Web Requests in Jira Automation is seen by many as being somewhat insecure, due to the need to embed credentials for API authentication in the rule. If you trust all your Jira admins, the risk is minimal.

Good luck!

Antonio Calì
Contributor
December 27, 2021

Thank you @Mykenna Cepek, your answer gave me a good idea.

I talk to the Jira admin about it and try it out. 

Kind regards, 

Antonio

0 votes
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.
December 23, 2021

Hi @Antonio Calì -- Welcome to the Atlassian Community!

What problem are you trying to solve by doing this?  Knowing that may help the community to offer suggestions.

As Nic notes, you cannot currently use automation functions to directly access the issue history (other than an elaborate work-around calling the REST API).

Depending upon your use case/need, it may be easier to save the user who made that status change when it happened with {{initiator}} with one rule, and then use that information later for the assignment in a different rule.

Kind regards,
Bill

0 votes
Nic Brough -Adaptavist-
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.
December 23, 2021

Automation does not have the function you need to be able to read the history like this.  I think you'll need one of the scripting apps to do this.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events