We would like to have an automated "calculated priority" calculated using JIRA Misc Custom field at issue creation.
We want to use this calculated priority to be used to set some of the fields of the issues (for example the standard priority, target date,...) using an automation plugin.
To pipeline/order the processes, we would like to know
* what trigger the "calculated priority" calculation (issue created JIRA postfunction? Another postfunction?)
* if you know some tricks what can be used to pipeline the jobs (if the calculated customfield raise an event, or if this is possible to set a properties / field of the JIRA issue)
Calculated custom fields created by JMCF are updated when the issue is reindexed, which happens when the issue is modified or transitioned.
However, you will also get a newly calculated value when you access the field using a JMWE (JIRA Misc Workflow Extensions) post function. So you could use JMWE post-functions on your create transition to do the other changes required (using Groovy scripts as value or condition). You might just have to push the post-functions down the list of you get errors.
To access the Calculated field from a Groovy script, use issue.get(field name).
Alright, thanks for explanation,
"JMCF are updated when the issue is reindexed, which happens when the issue is modified or transitioned"
"So you could use JMWE post-functions on your create transition to do the other changes required"
We tried with JIRA Suite Utilities postfunction. It works in Workflow transition, but not for issue creation (even when this is the last postfunction = after reindexation.
Have you already tested if this work with JMWE at issue creation? (it seems to be the same functionnality, but maybe not the same implementation..)
Unfortunately, you are right. Recent versions of JIRA caches an invalid null value for all calculated fields during issue creation, instead of waiting for the field to be accessed to calculate its value. This actually has nothing to do with the index (which is only used for searches and the tabular search results view).
There are two possible workarounds:
Issue myIssue = ComponentAccessor.getIssueManager().getIssue(issue.id)
if (myIssue.get("my calculated field") == [...]
The second solution requires that the Set Field Value post-function be placed at the bottom of the list.
First of all, calculation only occurs when a "view issue" screen is displayed - never during a transition. [...]
Then, calculation occurs during indexing - at which time you cannot modify an issue.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs