Advanced compare condition issue
Asked by Santosh Subudhi:

**Advance compare condition issue**

I need to compare due date from parent issue with linked.So we have used condition in automation as

{{issue.duedate}} less than {{lookupissues.due.max}}

But it is not working

**Actual Result**

Automation audit log says as NO ACTIONS PERFORMED.Condition is not executing properly.

**Expected Result**

It should return true if parent issue due is less than linked issue due date.

Example

Parent Issue

<https://rb-tracker.bosch.com/tracker03/browse/TESTINGPROJECTONE-302>

Linked Issue

<https://rb-tracker.bosch.com/tracker03/browse/TESTINGPROJECTONE-437>

Created an automation as


Answers:
author: Duc Thang TRAN
body: Hello [@Santosh Subudhi](/t5/user/viewprofilepage/user-id/1147632)

In the absence of other conditions like the trigger and context,

we agree that your ticket TESTINGPROJECTONE-302 is the parent of ticket TESTINGPROJECTONE-437 ?

If so, you can manual trig a automation like this one to compare duedate parent vs duedate max of all child

![2024-06-27 17_15_07-Rule builder - Automation - Admin Jira - Test - Jira ? Mozilla Firefox.png](https://community.atlassian.com/t5/image/serverpage/image-id/332158i3E3561E213E612D6/image-size/large?v=v2&px=999 "2024-06-27 17_15_07-Rule builder - Automation - Admin Jira - Test - Jira ? Mozilla Firefox.png")

comments: author: Santosh Subudhi
body: Hello TRAN,

Please find my automation rule.

Thanks-Santosh![automation rule.png](https://community.atlassian.com/t5/image/serverpage/image-id/333982i8CABBB051D35BFFA/image-size/large?v=v2&px=999 "automation rule.png")


author: Santosh Subudhi
body: ![automation rule.png](https://community.atlassian.com/t5/image/serverpage/image-id/333981i87D678745266742E/image-size/large?v=v2&px=999 "automation rule.png")

comments: author: Santosh Subudhi
body: Hello TRAN,

We are looking some automation if linked issue date date is greater than parent issue due date then it will replace by parent issue due date.

Thanks-Santosh


author: Bill Sheboy
body: Hi [@Santosh Subudhi](/t5/user/viewprofilepage/user-id/1147632) -- Welcome to the Atlassian Community!

For a question like this, please post an image of your complete automation rule, images of any relevant actions / conditions / branches, an image of the audit log details showing the rule execution, and explain what is not working as expected. Those will provide context for the community to offer ideas. Thanks!

Until we see those...

You appear to be using Jira Data Center. Is that correct?

If so, the Lookup Issues action's results do not contain all issue fields yet. Here is the suggestion to add them: <https://jira.atlassian.com/browse/JIRAAUTOSERVER-877>

According to the documentation, the Due Date field is not supported for Lookup Issues yet: <https://confluence.atlassian.com/automation/jira-smart-values-issues-993924860.html#Jirasmartvaluesissues-lookupissues-properties> I recommend checking by writing the value from the Lookup Issues result to the audit log to check it.

Without seeing the specifics of your rule...there are two possible workarounds:

* Use the bulk-handling option of scheduled triggers and branches: <https://confluence.atlassian.com/automation/run-a-rule-against-issues-in-bulk-993924653.html> This approach may not work for your scenario as you want to edit the parent issue.
* Using the [Send Web Request action, call the Jira REST API for an issue search](https://community.atlassian.com/t5/Jira-articles/Automation-for-Jira-Send-web-request-using-Jira-REST-API/ba-p/1443828) to load the linked issues. Then use the {{webhookResponse}} to find the date needed for the comparison and update.

Kind regards,  
Bill

comments: author: Santosh Subudhi
body: Hello Bill,

Please find my complete automation rule here.


author: Bill Sheboy
body: First, the rule you show is comparing a single issue's fields to that issues subtasks. But earlier you noted checking this for "linked issues". Do you in fact want to check the subtasks?

Next, I noted earlier that some issue fields are not loaded for Lookup Issues. The same is true for the subtasks smart value. Please try writing this to the audit log to confirm it has a value before the condition:

```
maximum subtask due date:?{{issue.subtasks.duedate.max.jiraDate}}
```

Finally, comparison of date values in automation rules can be problematic as some date fields appear as text within the rule. The solution for this is to always use a known format which supports comparisons.

For example, you could change your comparison to:

* first value: {{issue.duedate.jiraDate}}
* condition: less than
* second value: {{issue.subtasks.duedate.max.jiraDate}}


author: Santosh Subudhi
body: Hello,

We need to check if any parent issue have some linked issues.Automation will check which linked issue have highest due date will compare with parent issue due date.If it is greater then it will replace to parent issue due date.If it is lesser then it wont do any changes.

So i used Advanced compare condition in automation which is not working.

Could you please suggest me for this.

Thanks-Santosh


Tags: data-center

jira-data-center