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
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
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:
jql =<span> </span>"'End Date' < now()";string[] keys = selectIssues(jql);for (k in keys) { autoTransition("Transition Name", k);}string jql;
jql =<span> </span>
"'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:
<a href="https://confluence.cprime.io/pages/viewpage.action?pageId=6558186" target="_blank" rel="nofollow noopener noreferrer">https://confluence.cprime.io/pages/viewpage.action?pageId=6558186</a>
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.
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.
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.
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.
just define k and make autoTransition non-camel and you're good to go:
jql =<span> </span><span>"'End Date' < now()"</span>;<span>string</span>[] keys = selectIssues(jql);<span>for</span> (k <span>in</span> keys) { autotransition(<span>"Transition Name"</span>, k);<span>string</span> jql;<br>string k;
<span>"'End Date' < now()"</span>
<span>string</span>[] keys = selectIssues(jql);
<span>for</span> (k <span>in</span> keys) {
autotransition(<span>"Transition Name"</span>, k);
It looks like you're new here. Sign in or register to get started.