Im trying to associate a select list field options as numbers using the variables in my automation rule but I seem to get null results. I referenced an article showing an example of this being done on Data center. Im wondering if the syntax is supposed to be different on cloud. Here is an example of what I have for 1 of my variables.
Final action is edit "Rice Score" field with
{{#=}} {{Reach}} * {{Impact}} * {{Confidence}} / {{Effort}} {{/}}
Reach variable
{{if(equals(issue.customfield_20039.value, "1 Team"), "1", if(equals(issue.customfield_20039.value, "10 Teams"), “2”, if(equals(issue.customfield_20039.value, "Most Teams"), “5”, if(equals(issue.customfield_20039.value, “All Teams"), “10”))))}}
Hi @kazu okamoto -- Welcome to the Atlassian Community!
First, I recommend using a Lookup Table for this type of field mapping: https://community.atlassian.com/t5/Automation-articles/Update-Create-lookup-table-action-improvements/ba-p/2427798
This would allow getting the number in one step:
{{varReachValue.get(issue.customfield_20039.value)}}
Next, in your smart value expression, there are some curly / slanted quotation marks, and those are likely causing problems within the nested conditional expression.
Kind regards,
Bill
@Bill Sheboy Thanks for the suggestion. The lookup table worked perfectly for me!
Final calculation smart value: {{#=}}{{rice.get(issue.customfield_20039.value)}} * {{rice.get(issue.customfield_20040.value)}} * {{rice.get(issue.customfield_20041.value)}} / {{rice.get(issue.customfield_20042.value)}}{{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome; I am glad to learn that helped! Two more things:
1) Are the fields required or could they be empty? And if empty, what should happen?
For example, you could add default values of zero by adding a |0 default value after each get() call.
2) The division in the formula will produce a floating point number. If you want manage the precision for the number of decimal places, you could add the ROUND() function: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-math-expressions/#Functions
For example, this would round to 2 decimal places, with the 0 defaults added in the numerator. As there is division, dividing by zero will lead to a math error, so consider what to use for the denominator (Effort) value default.
{{#=}} ROUND( {{rice.get(issue.customfield_20039.value)|0}} * {{rice.get(issue.customfield_20040.value)|0}} * {{rice.get(issue.customfield_20041.value)|0}} / {{rice.get(issue.customfield_20042.value)}}, 2){{/}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.