I have 2 Custom fields Severity(Select List (single choice)) and Probability(Select List(single choice) and these 2 multiply each other need to store in Score(Number Field)Custom field using Automation. Here severity and Probability are 2 dropdown fields.
Severity values:
1-Major
2-Minor
3-Critical
Probability Values:
1-Critical
2-Major
3-Negligible
Expected how to works:
Severity * Probability=Score
2-Minor * 3-Negligible=6
Please help me in this
Hi @thumuluru_shreya , thanks for your question.
I'm doing something like this for two of my customers using lookup tables. The benefit of this approach is that you can modify easily the number / weighting associated with each value.
So, you create a lookup table for each custom field and insert the mapping / weighting.
Then, in the action, you need to get the custom field ID's and then should be able to insert this calculation
{{#=}}{{Severity.get(issue.customfield_YOURID)}} * {{Probability.get(issue.customfield_YOURID)}}{{/}}
Please have a go on your instance and share your feedback.
Best wishes
hi @Valerie Knapp , Thanks for helping. After adding these rules to my rule. No action is performing. Could you please help in this?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @thumuluru_shreya , what trigger are you using in the rule? Can you show what you've built? And the audit log?
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Valerie Knapp , Please check I performed an action but there is no results showing on that in audit log.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @thumuluru_shreya , thanks for sharing the rule.
Can you try to please to change the trigger to something else, like an issue update or transition and see if you can get it to be called?
Cheers
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.
Hi @thumuluru_shreya , thanks for sharing the audit log.
Please can you copy the formula you have in the action for the field RPN? The audit log is saying there is a mistake in the formula syntax.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Valerie Knapp , This is the formula I used
{{#=}}{{Severity.get(issue.customfield_10324)}} * {{Occurrence.get(issue.customfield_10325)}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @thumuluru_shreya , thanks.
Please can you remove the spaces either side of the * and try again?
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That error indicates two things:
First, when accessing the selected value for an option field, the default is to return the option's id and not the value. When you want to use the value in the get() function calls, that should be:
{{#=}}{{Severity.get(issue.customfield_10324.value)}} * {{Occurrence.get(issue.customfield_10325.value)}}{{/}}
Next, from your original question, the values look like this: 1-Major, 2-Minor, etc. And those values do not match your lookup table keys, so they will not match.
This is why I suggested using text functions and a math expression earlier. Let's assume the first character of each of your select-option fields is a number. And so the value without using lookup tables would be this:
{{#=}}0{{issue.customfield_10324.value.left(1)}} * 0{{issue.customfield_10325.value.left(1)}}{{/}}
That extracts the first character of each selection, adding a 0 default value at the front, and multiplying to get the result.
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy , Thanks for Support! I got expected output.
Here I have some modification to My question. Could you please help in this.
Q:I have 2 Customfields as Severity and Occurrence. These 2 customfields are dropdown fields. It Contains
Severity contains the dropdown values as(Negligible, Minor and Major).
Occurrence contains the dropdown values as (Critical, Probable and Improbable)
Score is the numeric customfield to store the multiplication of both severity and occurrence
Ex:
Scenario 1:
If user selects
severity as Negligible (Internally it assumes as 1)
Occurrence as Probable (Internally it assumes as 2)
So in score the result will calculate as 1*2=2
Scenario 2:
If user selects
Severity as Major( Internally it assumes as 3)
Occurrence as Critical(Internally it assumes as 1)
So in score the result will calculate as 3*1= 3
Expected output:
We took 2 customfields as dropdown list and we are expecting the output as multiplication of both customfields as Numeric. And this numeric multiplication calculation of both dropdown list will happen internally. Eralier we have severity and occurrence both as numeric but now both are changed as dropdown list.
Finally the calculation should happen internally.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for that information, and that is different than the question you originally asked.
As the custom field options just have the text (e.g., Negligible, Minor, and Major) the lookup tables are needed as @Valerie Knapp suggested or you could use conditional logic.
Using the lookup tables, the expression would be what I noted using the value attribute:
{{#=}}{{Severity.get(issue.customfield_10324.value)}} * {{Occurrence.get(issue.customfield_10325.value)}}{{/}}
Again, the keys to making this work are what Valerie noted:
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.
Hi @Bill Sheboy and @Valerie Knapp . I have doubt in saving name in look up variable. We cannot save look up variable name as Post Occurrence or Occurrence (Post). Because I need to use 2 Occurrences those are Pre Occurrence and Post Occurrence. But I am not able to save in Look up variable. Is there any work around for this?
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.
@Kumar_rajarapu , Space should be there in my requirement. How to handle this error in look up table?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can't as stated by @Kumar_rajarapu and the warning message says it also.
You can only use alphabetic characters, so no spaces or other special signs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Whenever you ask for help with an Automation Rule it will help us to help you if you provide:
1. what type of project is this (e.g., company-managed, team-managed, etc.),
2. images that show your complete rule.
3. images showing the details of the actions/conditions/branches.
4. images showing the Audit Log details for the rule execution.
5. images showing the relevant data in an image that is part of the rule execution.
6. Explain where the issue is.
These questions are not for not willing to help, but to have community members learn on how automation works.
Not just to provide a full solution, which would not help to understand what the automation is doing, but to have members understand what a rule is doing, if in need of change or error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As @Marc - Devoteam suggests, context is important for automation rule questions: please post the complete rule, action details, and audit log details to help the community provide suggestions.
Until we see those...
If the values you show are in fact the values of the custom fields, you could use:
To make this work, you must use the correct smart values (or custom field ID values). To find those, use this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @thumuluru_shreya ,
Create Automation Rule:
Trigger: Field value Updated.( Add fields -Severity, Probability)
Condition: (Optional) Set conditions if necessary
Action: Edit Issue Field (Add field -Score)--choose set value(add below JSON Script)
Smart Value Calculation: Use smart values to calculate the score
Add JSON script
[" {
"fields": {
"Score": "{{#=}}(
(if(issue.Severity == "Major", 1, if(issue.Severity == "Minor", 2, 3))) *
(if(issue.Probability == "Critical", 1, if(issue.Probability == "Major", 2, 3)))
){{/}}"
}
}"]
Example:
2 (Minor) * 3 (Negligible) = 6 (Score)
Regards,
kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kumar_rajarapu , Could you please explain or send screenshot from JSON where I need to add this step exactly it will be helpful for me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually I'm not able take the Screenshot
Action component: choose Edit Issue Field (Add field - Score)
In Action, after selecting the field in 'Edit issue',
click on 'More options' below
In the 'Additional fields' box, add the JSON script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Set values for fields on the issue. Simply add the fields you want to edit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kumkum , Hi Kumar what are the smart values need to add ? Then what is the smart value section? Is it necessary to add in this automation rule
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.