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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,462,136
Community Members
 
Community Events
176
Community Groups

Help with a Jira smart values - conditional logic

Hi,

In a comment I am testing conditional logic and when ready, I hopefully can use the condition when editing a field so it is only updated if the condition passes.

In the rule I create a variable to set the day difference between the old date and the new date. I current edit the field to have the new date set in another field. But I'd like it to only update the field if it is later than the current date. I am not given the option to add a tule condition, most likely because I alreday am in an If/else condition.

The variable does the following which works perfectly, where its name is called daysDifference.

{{issue.customfield_10109.diff(fieldChange.to.toDate).days}}

days diff - [{{daysDifference}}]

-
{{#if(daysDifference.gt(0))}}
>> Change the date to the new date.
{{/}}

The variable print gives the correct day difference, but i get nothing from the smart valu condition, even if the value is greater than 0.

 

Does anyone see what i'm doing wrong or missed in the condition please?

 

Thanks,

Aldo

 

1 answer

1 accepted

1 vote
Answer accepted

Hi @AldoCauchiSavona 

I wonder...currently created variables are always text type, so perhaps the gt() does nothing on that value.  Please try converting the variable with asNumber before performing the comparison inside of the condition:

{{#if(daysDifference.asNumber.gt(0))}}
>> Change the date to the new date.
{{/}}

If that does not help, please post images of your complete rule and the audit log details showing the rule execution.  Those may provide context for the community to offer suggestions.

Kind regards,
Bill

Thankd a lot @Bill Sheboy Problem solved.

Like # people like this

Suggest an answer

Log in or Sign up to answer