I want to create an automation to populate a numeric Importance field based on the index of the dropdown fields Severity and Frequency like so:
Importance = Severity * Frequency
where the Severity values "Minor", "Major" and "Critical" are converted into their index in the dropdown (that is, Minor = 1, Major = 2...).
My automation Edit Field step looks like this:
{{#=}}{{issue.Severity}} * {{issue.Frequency}}{{/}}
but these are obviously translated into their value texts, not their indices.
Is there a way for me to get the index of a dropdown value? If not, how do I set variables based on dropdown values and use them to do the math?
Hi Roberto,
We do something similar and below is an example. There might be a more efficient way of doing it, but I created a Branch for each value in the Severity field (in my example it is the Impact field). Then I use the numeric value in the calculation of the Importance (in my case, Risk Score). Hope that helps. Ignore the variable I created, I had to do some other more complicated stuff with it.
To anyone interested, this is what worked for me:
{{#=}}
{{if(not(exists(issue.Severity.value)),0)}}
{{if(equals(issue.Severity.value,"Trivial"),1)}}
{{if(equals(issue.Severity.value,"Minor"),2)}}
{{if(equals(issue.Severity.value,"Major"),3)}}
{{if(equals(issue.Severity.value,"Critical"),4)}}
*
{{if(not(exists(issue.Frequency.value)),0)}}
{{if(equals(issue.Frequency.value,"Rare"),1)}}
{{if(equals(issue.Frequency.value,"Occasional"),2)}}
{{if(equals(issue.Frequency.value,"Frequent"),3)}}
{{if(equals(issue.Frequency.value,"Permanent"),4)}}
{{/}}
I'm not sure this is as succinct as it could be as I don't know this syntax well.
I feel I should have done the lookup table as described in the other answer, though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @roberto_sc
You could do this using conditional logic (to return the value for the fields) or use lookup tables to translate the fields into their numeric values.
Then, perform the calculation with a math expression.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.