Hi everyone,
We have a requirement to take two fields' values (Urgency and Impact), both of which have levels 1-4 that can be selected, and calculate the average of those two into a third field (Priority). This has to happen either when an issue (of a particular request type) is created or when the Impact field is updated. How can we configure this automation most effectively?
Thanks!
Welcome to the community @Jure Jerebic
First you need to identify the IDs' for both of the custom fields that have been created. You would need to create the automation rule when the issue gets created for the specific issue type (unless this applies to all of the issue types).
For the action you would need edit issue and to select the Priority field - make sure that this field is different from the already existing system field - my suggestion give it a different name.
Basic calculation: {{issue.customfield_10486}} + {{issue.customfield_10487}}
Since you need average, do the addition of two custom fields then depracte it with 2.
What would I set as the trigger? I need this to run whenever an issue of that request type is created or the Impact value is updated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use only one of the triggers:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's what I thought as well, so I'll have to create two automations. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Jure Jerebic Not quite. Only one when the issue is created then to do the calculation for the Impact field, which is done with Edit issue action.
So it would be like this:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I meant two different automations for:
1. issue is created -> do the calculation and update the final calculated field
2. issue is updated (Impact is edited - we won't change the Urgency) -> do the calculation and update the final calculated field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, I didn't know you want to do the calculation twice. But, yes in that case, you would need two. Also, if you found my answer helpful, please mark it as accepted as there might be other people asking this question, so they can reference it easier.
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.
I can't seem to add the calculation into the Edit Issue action, I can only pick between the options that are available there; I also don't know what exact calculation I should use to get the average of two fields; note that this field that should be calculated is a single select field - or do they have to be text fields?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To find the average of two numbers, you should sum them first then divide by 2. You need to replace the {{issue.customfield_xxxx}} with the IDs' of your custom fields that you are doing the calculation for. To find the IDs', navigate to Settings > Issues > Custom fields. Find your fields and click on Edit details.
In the address bar you will see ID showing. In my case it's 10052, yours will be different.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Would this syntax be correct?
{{#=}}({{issue.fields.Impact}} + {{issue.fields.Urgency}}) / 2{{/}}
Also, I still cannot add that syntax into the automation to add it into that field, does it have to be a free text field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It's not correct, since you need to use the {{issue.customfield}}, please refer to the previous comment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So this then:
{#=}}({{issue.customfield_11870}} + {{issue.customfield_11051}}) / 2{{/}}
What about the issue of not being able to add this to the destination field in the automation?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
{#=}} is not needed. Also the field has been specified which is Priority.Also for value changes you need to add the Urgency as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I only want to change the value of Priority:
1st source field: Impact (values 1-5)
2nd source field: Urgency (values 1-5)
Calculated end field: Priority (values 1-5)
This should happen in two scenarios:
1. a new ticket is created
2. value of Impact is edited on an existing ticket
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To better explain:
1.When the new ticket gets created, Priority gets calculated based on the formula from the screenshots
2. I see, it was not mentioned by the way that this is for the existing ticket. Nevertheless, Priority is based on the calculation of Impact and Urgency
What supposed to be a confusion here? Maybe I do not understand it as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct, so it should use that formula. However, I can't paste the formula into the field in the worklow, see the screenshot above
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jure Jerebic ,
Welcome to the Atlassian community,
You can follow this sample automation:
Trigger: Field value changed - impact
Condition:
If or Else Add condition option:
If block:
Add condition -
Issue field condition - Impact equals 1
Issue field condition - Urgency equals 1
Action: Edit field - Priority - low
Add else (If else)
follow the condition and action then change the value
So on and so forth until you align all the condition and value.
You can check this list of documentation to learn more about creating and configuring Jira cloud automation.
https://support.atlassian.com/cloud-automation/docs/create-and-configure-jira-automation-rules/
Hope it helps.
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dexter de Vera , @Jure Jerebic is looking for calculating two fields,not just the automation set up.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nikola is correct, I don't want to set up a whole line of all the possible calculations through conditions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nikola Perisic Alright. On my own understanding based on the description of this question, I think his looking for a condition based on the value selected in the dropdown list (Urgent and Impact) and then select the appropriate Priority. But yes, you can explain to him based on what you understand. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Nikola Perisic Alright. you may follow the instructions of @Nikola Perisic answer.
Thank you!
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.