Forums

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

Issue with Date diff. in Jira automation - Rule passes but criteria not executed

Maxim Bode June 27, 2022

Hello community,

 

1 Challenge: I am facing an issue with a JQL condition that has a date diff. function which is not executed when the rule runs with a scheduled trigger (CRON) every working day.

 

2 Rule: The objective of the rule is to create tickets based on a certain time event i.e.Date Diff 2.png

when the parent ticket is created 21 days prior to the date when a new person joins the company AND if it is 7 days to the joining date, the ticket for onboarding must be created. For the case when it is less then 21 days, I have another rule (with the logic vice versa) which is facing the same issue.

In my else-if branch I have besides other conditions a JQL condition with the following requirements:

{{[issue.parent.created].diff([issue.parent.join Date]).days>21}}

However, this condition is not executed by the automation when the rule runs.

Date Diff 1.png

3 Dates: I take the creation date of the parent ticket and the join date from the description that is inserted via a short code section as you can see below.

Creation Date

Date Diff 4.png

Parent Join Date

Date Diff 5.png

Date Diff 6.png

4 Example: As you can see in the example below, the rule created the onboarding tickets for the following parent ticket where you can see that the date diff between the creation date and the join date is smaller than 21 days. 

1st July -> 23rd June = 8 days

Date Diff 3.png

 

I have the feeling that it could be related to the way the two dates are formatted but not 100% sure. I hope someone from the community can help.

Thanks in advance!

Maxim

1 answer

0 votes
John Funk
Community Champion
June 30, 2022

Hi Maxim,

I would say let's break this down into chunks and do one piece at a time to make sure it is working. 

So, copy your existing rule and take out everything except the initial Scheduled trigger with the JQL in it and the email. But change the email to just email to you. 

Then create a test card that meets the criteria in your JQL. But change the JQL to include the key of the test card - so whatever you have in the JQL just add "and key = ABC-123" where that is the test card. 

The manually fire the scheduled trigger and see what happens. If success, then repeat the test, but change the test card first to have a join date that would put the card out of range. Manually run the test again and see what happens. 

I would start there first. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events