Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Adding 2 values using Smart Values in an automation

Anthony Esslinger August 30, 2024

I am trying to add 2 smart values and then divide it by 2 to set a 3rd field value. I am using the following to try and just add the 2 numbers but it isn't working:  

{{#=}}{{issue.Person Priority}} + {{issue.Issue Priority}}{{/}}

I would think that if this worked I could divide by 2 using this 

 

{{#=}}{{issue.Person Priority}} + {{issue.Issue Priority}} / 2{{/}}

but with the Person Priority being 4(set by previous automation) and Issue Priority being 4(set by Post function), the Dynamic priority set by the above smart values = 4 instead of 8. 

Any help would be greatly appreciated. 

1 answer

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2024

Hello @Anthony Esslinger 

Is this in the context of an Automation Rule? If so, please provide screen images that show the entire rule and details of each step. Also please provide the details from the rule execution audit log.

 

I am trying to add 2 smart values and then divide it by 2 to set a 3rd field value. I am using the following to try and just add the 2 numbers but it isn't working:  

{{#=}}{{issue.Person Priority}} + {{issue.Issue Priority}}{{/}}

How are you determining that it isn't working?

Are you validating that {{issue.Person Priority}} and {{issue.Issue Priority}} are numeric fields that each contain a value?

 

{{#=}}{{issue.Person Priority}} + {{issue.Issue Priority}} / 2{{/}}

but with the Person Priority being 4(set by previous automation) and Issue Priority being 4(set by Post function), the Dynamic priority set by the above smart values = 4 instead of 8. 

Are you saying the final value from that calculation is 4, and you expect it to be 8? 4 seems to be the correct value:

4 + 4 / 2 

4+4 = 8

8 / 2 = 4

 

I recommend that you make liberal use of the Log action in your rule to print to the rule execution log the value of each smart value you are using.

Anthony Esslinger August 30, 2024

I am using the first calculation {{#=}}{{issue.Person Priority}} + {{issue.Issue Priority}}{{/}} and it returning 4 when it should be 8

 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 30, 2024

I recommend that you use the Log action in your rule to print into the rule execution log those two smart values immediately before the step where you do that calculation. I suspect that will reveal those smart values are not what you expect them to be.

For additional help we will need you to provide screen images showing the entire rule and the details of each step.

Anthony Esslinger August 31, 2024

How do i get the audit log to show me the values it is taking for the 2 smart values?

 

Anthony Esslinger August 31, 2024

image.png

Anthony Esslinger August 31, 2024

image.png

Anthony Esslinger August 31, 2024

The delay is to insure that the Person Priority and Issue Priority are filled before the next automation tries to add the 2 fields

 

Anthony Esslinger August 31, 2024

image.png

Anthony Esslinger August 31, 2024

Those are the steps of the automation

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 31, 2024

As I mentioned you can use the Log action to write information into the Audit Log. You can find info on that action in the documentation for Actions.

https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/

You can fill in the Log action withe explicit text and smart values such as

Person priority: {{issue.Person Priority}}

That will print the literal text 

Person priority:

and the value of the smart value.

Anthony Esslinger September 8, 2024

Person priority.jpg

Anthony Esslinger September 8, 2024

So I set up 3 comments to show the Person Priority. One happens when the ticket is created, next happens 3 seconds later and the 3rd happens after an additional 10 seconds. In all cases it shows that {{issue.Person Priority}} is empty but the value of the Person Priority shows up in the ticket as 3.5 as soon as the ticket is created. It just doesn't make sense, I don't know what I am doing wrong. 

 

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 8, 2024

Please provide images showing your current rule and details of each step, since you have modified it.

You may want to try adding a Re-fetch Issue action to you rule, after the trigger. Sometimes the trigger happens before all data has been saved. The Re-fetch Issue action will re-query Jira to get the current data.

You can find the action described in the documentation.

https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/

On a side note, you don't need to write the information in an Issue Comment. You can use the Log action I mentioned previously to write the information into the rule execution log. Adding comments can cause notifications to be sent to individuals related to the issue, which may be undesirable.

Suggest an answer

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

Atlassian Community Events