In Jira Cloud, I have 3 custom fields: PII, PCI and PFI.
Each can be answered Yes or No. If Yes, value = 2 and if No, value = 1.
I have a fourth customer number field named Total Risk Score.
Using Automation, I want the Total Risk Score to equal the values from the first 3 custom fields.
When accessing a selection custom field, the value attribute may be used to access it. Otherwise the default attribute is returned, which is the id value of the selection.
For example, to get the value the user sees, try this:
{{issue.mySelectionField.value}}
For your case, that would return either "Yes" or "No". Please update your rule accordingly, or your conditional logic (testing the field) will only return null values.
One more thing to check...Smart values are name, spacing, and case-sensitive. And they often do not match the displayed name on the issue pages. To confirm the correct smart values for a field, please use this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/
Kind regards,
Bill
Hi @Fernando Garcia, welcome to the Atlassian Community. You can use variables and smart values for this.
Set 1 or 2 into a variable based on Yes or No, like this
Create one variable for each.
{{#if(equals(issue.PII, "Yes"))}}2{{/}}{{#if(equals(issue.PII, "No"))}}1{{/}}
{{#if(equals(issue.PCI, "Yes"))}}2{{/}}{{#if(equals(issue.PCI, "No"))}}1{{/}}
{{#if(equals(issue.PFI, "Yes"))}}2{{/}}{{#if(equals(issue.PFI, "No"))}}1{{/}}
Then you can use math expression to calculate, like this example
{{#=}} {{varPII}} + {{varPCI}} + {{varPFI}} {{/}}
This will sumarize the three variables.
I'm not fully sure if you mean "sum" or something else when you say "...Total Risk Score to equal the values", but I used sum in this example.
The rule might look something like this
I have used the Summary field in my example (see yellow marking), so you should replace this with your field Total Risk Score. Also use a Rule trigger and add a filter based on your specific need.
TimK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tim,
thank you so much for your detailed response. I get this error when running my new rule: error rendering smart value when executing this rule: missing parameters for operator +u: +
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.
Thank you so much for the detailed example. I tried building out what you recommended but still received this error:
Edit Issue
Error rendering smart-values when executing this rule:
Missing parameter(s) for operator +u: +
Automation:
Smart Value/Variable 1: {{#if(equals(issue.fields.Information Privacy PCI, "Yes"))}}2{{/}}{{#if(equals(issue.fields. Information Privacy PCI, "No"))}}1{{/}}
Smart Value/Variable 2:{{#if(equals(issue.fields.Information Privacy PII, "Yes"))}}2{{/}}{{#if(equals(issue.fields. Information Privacy PII, "No"))}}1{{/}}
Edit Issue Rule:{{#=}} {{varPII}} + {{varPCI}} {{/}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Fernando Garcia, try removing .fields from issue.fields.
It should be issue.Information Privacy PII
TimK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tim,
I get the same error:
Error rendering smart-values when executing this rule:
Missing parameter(s) for operator +u: +
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Fernando Garcia, I see that you have used other variable names on the math function than the variables that you created. The math function will not work if the variable names doesn't exist.
In the math function you are using varPCI and varPII (ref yellow markings)
But when you created the variables you used only PCI (not varPCI) and PII (not varPII) as shown below (ref yellow marking)
I used e.g., varPCI as the variable name in my example because I thought you had a field called PCI. You might call the varible PCI if you want but when you use the variable other places like in the match function it must match.
In your match function you are referring to varables that doesn't exists.
Let me know how it works when you have updated this.
TimK.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Tim
When I added log action for the variable the output i'm getting is null, and editing issues is also throwing error
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.
{{#if(equals(issue.What is the impact to users and/or Customers?, "None"))}}0{{/}}{{#if(equals(issue.What is the impact to users and/or Customers?, "No Impact"))}}5{{/}}{{#if(equals(issue.What is the impact to users and/or Customers?, "Loss of Redundancy"))}}15{{/}}{{#if(equals(issue.What is the impact to users and/or Customers?, "Downtime"))}}20{{/}}
for example the variable written for fone and getting below error
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.