I'm trying to use variables to associate numercial values to values in other fields. I have four variables. Reach, Urgency, Impact, and Executive Importance. Each of those fields has selections such as "High", "Medium", "Low". I want to associate numerical values to those selections for each of the 4 fields and then apply a summation to get a total score.
I've tried using code like this in the smart value section of creating a variable , but I'm getting an error. Here's an example of trying to apply this for the reach variable (customfield_10060)
Name: reachValue
SmartValue:
{{#=}}
{{#if(equals(issue.customfield_10060, "Very High"))}}13
{{else}}{{#if(equals(issue.customfield_10060, "High"))}}8
{{else}}{{#if(equals(issue.customfield_10060, "Medium"))}}5
{{else}}{{#if(equals(issue.customfield_10060, "Low"))}}3
{{else}}{{#if(equals(issue.customfield_10060, "Very Low"))}}1
{{else}}0{{/}}{{/}}{{/}}{{/}}{{/}}
{{/}}
Any ideas what would make this work?
Hi @Brian Gauthier -- Welcome to the Atlassian Community!
As others have noted, that is the incorrect syntax for a smart value condition as {{else}} is not valid.
For this type of rule, I recommend using a Lookup Table to convert the values to the numbers: https://community.atlassian.com/t5/Automation-articles/Update-Create-lookup-table-action-improvements/ba-p/2427798
When you do that, use the value attribute of the fields so the display value is the key. For example:
{{varReachToScore.get(issue.customfield_10060.value)}}
Create a Lookup Table for each conversion value. Then if you wanted to sum that, that might be this, substituting in your correct custom fields:
{{#=}}
{{varReachToScore.get(issue.customfield_10060.value)}}
+ {{varUrgencyToScore.get(issue.urgency custom field.value)}}
+ {{varImpactToScore.get(issue.impact custom field.value)}}
+ {{varExecutiveImportanceToScore.get(issue.executive importance custom field.value)}}{{/}}
As a observation about your calculation, having a parameter such as "Executive Importance" is often an indication / smell of a process problem, where opinions rather than repeatable methods are impacting product management. Perhaps discuss that with your team coach and product management team.
Kind regards,
Bill
Hello @Brian Gauthier
As per the docu - u have referenced
> The smart values listed on this page can be used with actions where text fields are involved, such as the Add comment or Send email actions. They can be used to print outputs based on conditional logic such as if or and statements.
In other words - I understand - conditional logic smart values cannot be used in the creation of smart variables.
and then also - the "else" problem, mentioned by @Trudy Claspill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Brian Gauthier
Welcome to the Atlassian community.
What is the error you get?
Looking at the documentation for conditional logic I don't see any indication that {{else}} is supported. Did you see that syntax in an example somewhere?
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.