It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Auto transition based on custom field value

We have a end date custom field we mention a end date during creating a issue, when it reaches automatically a transition should happen from Status A to Status B.

Thanks,
Raj

3 answers

1 accepted

0 votes
Answer accepted

Hi @Raj Kumar,

If you can explore custom development as an option, then you can write a scheduler which wakes up and scans the JIRA issues (You can limit the scheduler processing to a specific project and specific status, based on your requirement) and execute the transitions/ change the status.

Regards,

Ravi Varma

In the mean time between the scheduler waking up and the field being updated the ticket would be in an inconsistent state. Not the most elegant solution imho.

Hi @Beppe Marcon ,

The scheduler can be run every 1 minute or 30 seconds.

Unless, all the created issues have the same end date, accurate till the 1 minute/30 seconds, which is highly unlikely, the scheduler should be processing few issues whenever it is triggered. 

Changing the status for less number of issues, should not take much time. 

If JIRA has performance issue due to high usage, I agree with your statement that the scheduler approach would have some latency, which is a known and accepted risk for any automated solution.

Regards,

Ravi Varma

You could create a scripted field in Scriptrunner for Jira which at execution (every time the issue is updated or viewed) compares the current time (you get this one with a groovy/java method) with the value of the end date field.
Then you can an specify with the internal jira api the transition of the issue your scripted field is placed on.
If you or a colleague have some scripting experience this shouldn't be to hard to realize.
With kind regards
Mario

You could but it would not work consistently. The reason is the event is triggered the moment the issue is being updated but is not finalized yet, the transition would try to transition the issue and find it in an inconsistent state and fail.

Apparently Jira cannot trigger transition based on field value update event. 

0 votes

Hello,

You would need an add-on for it.

For example, you could use the Power Scripts add-on:

https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation?hosting=cloud&tab=overview

With this add-on you could create a job, which is run by schedule. In this job you would select all issues with expired end date and auto transition such issues.

Your code would be like this:

string jql;

jql = "'End Date' < now()";

string[] keys = selectIssues(jql);

for (k in keys) {

  autoTransition("Transition Name", k);

}

You can find how to create a schdule job here:

https://confluence.cprime.io/pages/viewpage.action?pageId=6558186

The job would need to run very often and still there would be times of inconsistency before the job is called. Not very scalable and pretty dangerous imho.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

We want to hear from you! How do you use Slack and Atlassian together?

Hi Everyone! My name is Mina and I am on Atlassian’s Ecosystems Marketing team. Our team is focused on our technology partnerships and marketplace apps. One of Atlassian’s partners is Slack, who ...

71 views 0 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you