Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Automation for Jira - multiplying two variables together

Nigel Budd (CV)
Contributor
July 3, 2020

I want to create a risk result based on impact and probability.

Impact/Prob will be select list custom fields, an automation will work out a risk value.

I'm trying to use the Create Variable action, to set a value depending on the Impact selected by the user.

A final action to write the resulting value back to the Issue.

{{#=}}{{RiskProbability|0}}*{{RiskImpact|0}}{{/}}

 

If I exclude the |0, AFJ throws an error "unknown unary operator *", with the |0, the result is 0 so I believe AFJ is treating the smart variable as strings, is there any way to cast, or another way of fixing this?

 

1 answer

2 votes
Nigel Budd (CV)
Contributor
July 6, 2020

Managed to work it out, if anyone is interested.

For the Impacts, I prefixed each with a number. e.g. 1. Low

 

Create Variable Step:

Variable: RiskImpact

Value: {{Risk Impact}}

 

Create Variable Step:

Variable: iRiskImpact

Value: {{#=}}{{RiskProbability.charAt(0)}}{{/}}

 

then in the Edit Field

{{#=}}{{iRiskImpact}}*{{iRiskProbability}}{{/}}

Terry Meissner
Contributor
April 16, 2024

Mate, thank you!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events