Hi,
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)
Thanks you,
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).
David
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..)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @David _old account_ ,
can you please clarify something?
Here you mention that the calculation occurs " when the issue is reindexed, which happens when the issue is modified or transitioned". But in another post (https://community.atlassian.com/t5/Jira-questions/Can-other-field-values-be-changed-when-the-calculation-occur/qaq-p/431990) you mention that the calculation occurs whenever the "view issue screen" is displayed.
Can you please clarify exactly in which situations the calculated field will be refreshed/calculated?
Thank you :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
calculation occurs when:
but the index is not updated when the issue is simply displayed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @David Fischer . However I've noticed that the calculation is also made in the Issue Search page, right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are showing the results in the "Detail View", then yes because it is equivalent to viewing the issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, actually I'm using the standard Issue search page without the details; I'm using the List View mode... and it still calculates it :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are you using JMCF 2.x, and are you an admin of your Jira instance? In that case, it will indeed recalculate the value for each issue on the result page (so that errors, if any, can be displayed). But note that the search itself will still use the (old) index.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can't find at the list of fields the calculated fields at automation for Jira? why?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.