Help with a Jira smart values - conditional logic

AldoCauchiSavona November 29, 2022

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

2 votes
Answer accepted
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.
November 29, 2022

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

AldoCauchiSavona November 29, 2022

Thankd a lot @Bill Sheboy Problem solved.

Like # people like this

Suggest an answer

Log in or Sign up to answer