Mathematical Expression in an Advanced Compare Condition

Melissa Kibrick April 26, 2023

I am trying to create an automation that sends an email if one field is miscalculated. Custom Field 6 should be equal to 250 * Custom Field 2. 

I have an advanced compare condition that says

First value: {{issue.customfield_6}}
Condition: does not equal.
Second value: {{#=}}{{issue.customfield_2}} * 250{{/}}

I have an issue where 
Custom Field 6 = 1250
Custom Field 2 = 5
I'm still getting the email. I tried reversing the condition to "equals" and still got the email.

What am I doing wrong here?

1 answer

1 accepted

1 vote
Answer accepted
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.
April 26, 2023

Hello @Melissa Kibrick 

In your Automation Rule have you made use of the Log action to print out the value of Custom Field 6, Custom Field 2, and your math operation to ensure they have the values you expect?

Are your two custom fields Number type fields?

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2023

Hi @Melissa Kibrick 

Yes, and...to Trudy's answer: if you post images of your complete rule and the audit log details showing the rule execution those may help identify the cause, and exclude any causes from the rule structure/organization.  Thanks!

Kind regards,
Bill

Like Trudy Claspill likes this
Melissa Kibrick April 26, 2023

 

@Trudy Claspill Thank you! I didn't know about the log action. The values are coming is as 1250.0 and 1250. 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 26, 2023

Sounds like the advanced compare is a text compare, and not a numeric one!  And one of those values is not dropping unnecessary zero value, decimals digits.

So a couple of work-arounds are...

  • use the format() function to force the values to have the same format for comparison
  • use a single math operation and compare to 0, such as with this:
    • first value: {{issue.customfield_2.multiply(250).minus(issue.customfield_6)}}
    • condition: does not equal
    • second value: 0
Like # people like this
Melissa Kibrick April 27, 2023

Thankfully, I was able to use the "less than" compare to get what I needed. 

Thank you @Bill Sheboy for a more elegant solution.

Like Bill Sheboy likes this
Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 27, 2023

Melissa, will the "less than" always work if the values are reversed in magnitude?

If not, you can enforce the comparison order with the absolute value operator, abs, added to the end of that expression.

Like Trudy Claspill likes this

Suggest an answer

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

Atlassian Community Events