Forums

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

How can I compare 2 dates to take an actions in Jira automation

Leyla Kinaze
Contributor
August 23, 2024

Hi, 

I'm doing an automation related to the addition of a sprint to a story.
The automation is Target Start and Target End based on the sprint start and end dates.
This is working fine.


There is however an exception case that I want to handle. 
If the sprint is changed to an earlier sprint then the one that was planned for the story.

I would like to do a date comparison between the current TARGET START of the issue and the new sprint start date and only update the TARGET START if the TARGET START date is greater then the new sprint start date.

This is what I'm using but I don't think I have the right format.  Is there somewhere that I can refer to, in order to find information how to properly do the compare condition?  I tried other compare condition without success as well... and could not find the format to use...

{} ADVANCED COMPARE CONDITION
First value:
{{issue.targetstart.jiradate}}
Condition
greater than
Second value:
{{issue.sprint.last.startDate.jiraDate}}

 

 

1 answer

1 accepted

0 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.
August 23, 2024

Hi @Leyla Kinaze 

First thing, I recommend confirming that is the correct smart value for the Target Start field, either by writing it to the audit log or using this how-to article: https://confluence.atlassian.com/automation/find-the-smart-value-for-a-field-993924665.html

Next, is the "new sprint" start date always expected to be the latest one for any sprints in the field?  If so, I recommend changing that second value in the condition to this:

{{issue.sprint.startDate.max.jiraDate}}

 

If those ideas do not help, please post an image of your complete automation rule and of the audit log details showing the rule execution.  Those may provide context to help explain what is happening.  Thanks!

 

Kind regards,
Bill

Leyla Kinaze
Contributor
August 30, 2024

Hi @Bill Sheboy ,

thanks a lot for your fast answer.  It took me a couple of trial and errors to get it working but your feedback helped me a lot to make it work.

thank you!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer