Forums

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

Jira automation rule if: Matches condition passing when it shouldn't

Neil Ingram
Contributor
September 4, 2023

I have an automation rule that creates a smart value containing the difference in days between two dates. The difference is being stored in the smart value variable. I can see the value is correct because I'm storing the value in a comment on the issue the rule is running for.

In my example the difference in days is 15. 

Next in my rule I'm checking if the difference is less than 8. I'm doing this using if: matches. Even though the value is 15 the if statement is still passing and updating an issue field with the correct value. It's as if the rule is not recognizing that the values are numeric.

Any ideas why the if statement is passing when it shouldn't!?

 

2 answers

2 accepted

2 votes
Answer accepted
Trudy Claspill
Community Champion
September 4, 2023

Hello @Neil Ingram 

You have the correct answer - the smart value {{diff}} is not recognized as a number.

When you store a value in a Variable, it is stored as a string.

If you want to compare it as a number you need to use 

{{diff.asNumber}}

Neil Ingram
Contributor
September 4, 2023

Thanks Trudy. Just tried this and get the same result. Its still passing on the If statement when it should fail.

{{Diff}} contains 19 so the statement below should fail, but it doesn't.

image3.jpg

Neil Ingram
Contributor
September 4, 2023

Working now

Trudy Claspill
Community Champion
September 4, 2023

What was the change you made so that it started working?

Reviewing your initial images o see that you variable used a capital D in the Create Variable step. Smart values can be case sensitive so you would need to use a capital D everywhere you use the variable.

Neil Ingram
Contributor
September 4, 2023

Yes, capital D and also added .asNumber on the Create variable smart value, as you suggested. Thanks for the support.

Trudy Claspill
Community Champion
September 4, 2023

Thanks for confirming the solution.

If my guidance helped you solve your issue, please consider clicking the Accept Answer button for my Answer.

0 votes
Answer accepted
Neil Ingram
Contributor
September 4, 2023

supporting image: image1.jpgimage2.jpg

Neil Ingram
Contributor
September 4, 2023

FYI, above is not the answer. I couldn't attach images when submitting my question.

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