Jira Automation - If-Else-JQL Condition with date comparison

Maxim Bode May 24, 2022

Hi Atlassian Community,

 

I am running into an issue with an if-else condition. The automation needs to match a new comer joining date from one task description (issue.parent.Join Date) against today's date (now.jiraDate) to see if it is greater or equal to, and then perform a task.

The idea is to create tasks when they are needed (i.e. in sequence) and not all at the same time.

The automation rule:

1. Run everyday with JQL condition: Summary ~ "onboarding" and assignee = "Person1"
 
2. Then I do a match of today against the onboarding date from the task description (minus 21 days) because it needs to be 3 weeks before the a new person joins:
 
If block: {{issue.parent.Join Date.minusDays(21)}} = {{now.jiraDate}}
  • If match, then create a sub-task

3. Same here but with one week ahead

Else-if block: {{issue.parent.Join Date.minusDays(7)}} = {{now.jiraDate}}

  • If match, then create another sub-task

4. And here after he/she joined

Else-if block: {{issue.parent.Join Date}} <= {{now.jiraDate}}

  • If match, then create a sub-task
  • And another task

5. Else -> This should do nothing

  • add value to audit log: Do Nothing

Error: I am receiving this error and not sure if it is an issue with the logic or format of the dates?

Date Matching Issue 1.PNG

 

Here my automation process:

InkedDate Matching Issue - automation 1_LI.jpg

InkedDate Matching Issue - automation 2_LI.jpg

2 answers

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.
May 24, 2022

Hi @Maxim Bode 

The error message is indicating that your JQL in the conditions is failing, with the left side collapsing to null.  For example: {{issue.parent.Join Date.minusDays(21)}} = {{now.jiraDate}}

First thing: I could confirm the smart value for that custom field, such as using this how-to article: https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

 

Next thing, I would write this to the audit log to determine if there is a value in the field:

{{issue.parent.Join Date}}

My understanding is that not all fields of parent are directly accessible this way.  If they were, imagine a scenario of {{issue.parent.parent.parent.someField}} whereby the rule needs to have all the possible data in the issue's hierarchy available.

If it is empty, the work-around is to branch to the parent and grab the date, storing it in a created variable.

 

Next, it is possible that syntax for the JQL condition is the problem, and so that could be addressed by instead using an advanced compare condition and using diff() then checking the result:

  • first value: {{issue.parent.Join Date.diff(now).days}}
  • condition: equals
  • second value: 21

 

Kind regards,
Bill

Maxim Bode May 29, 2022

Thanks Bill for the comprehensive answer.

I changed the rule using an advanced compare condition and now this is working fine.

Kind regards,

Maxim

Like Bill Sheboy likes this
0 votes
Garrett McCreery
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.
May 24, 2022

Hi Maxim.

What doe the JQL look like in your trigger "Schedule" step? That's where it looks like the culprit is according to your logs.

Maxim Bode May 24, 2022

Hi Garrett, 

the JQL in the trigger is: Summary ~ "onboarding" and assignee = "Person1"

 

Hope this helps for further investigation.

Best

Maxim

Suggest an answer

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

Atlassian Community Events