Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to write an automation to autoclose new issue when 2 fields match?

Bridget Caci April 10, 2024

Hello,

I am trying to build an automation to automatically transition a new issue to Canceled status if the Target Date field value equals the issue create date.  I use Jira Service Management Data Center.

I can get the automation to work for all created tickets or none at all, but not for the conditions I need.

Here is my current version:

When: Value changes for Target Date

If: Customer Request Type equals Branch Rate Match Request

And:  Compare two values: Checks if {{issue.customfield_13901-val}} equals {{issue.Created-val}}

Then:  Transition the issue to Canceled

This version works for tickets when the Target Date = Created Date and when it does not equal.  For my test issue,  I entered 4/1/2024 in the Target Date field, with the Created date as 4/10/2024.  The Audit Log says this matched the Condition: Compare two values.

Can you advise on how I can set this automation so that it only auto-transitions when the fields truly match?

Thanks!

 

 

3 answers

2 accepted

1 vote
Answer accepted
Bridget Caci April 10, 2024

Here is a screenshot of my rule and audit log.

Screenshot of Automation and Audit Log.jpg

 

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

Take off the -val on the two fields. 

Bridget Caci April 10, 2024

I removed the -val and created a test issue, with Target Date: 4/10/2024 and Create Date: today (4/10/2024).  But the status did not auto transition.

Screenshot of Automation and Audit Log2.jpg

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

It's probably including the time. Maybe try .jiraDate on the end of each date field. 

{{issue.created.jiraDate}} for example. 

Bridget Caci April 10, 2024

Sorry, John.  Another strike out.  I completed the same test - new issue with Target Date and Create date as 4/10/2024.

Screenshot of Automation and Audit Log3.jpg

Kalyan Sattaluri
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.
April 10, 2024

Hello @Bridget Caci 

Please insert a log statement before your compare and log both values and share the audit log.

{{issue.customfield_13901.jiraDate}} equals {{issue.Created.jiraDate}}

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

Looks like there is a typo in your code. Try to page in Kaylan's example. Also you might need to put Created as created (lowercase) as it is case sensitive sometimes. 

Bridget Caci April 10, 2024

I haven't inserted a log statement before, so please let me know if I need to make changes.  As I have it written, it did not auto transition when I tested.

Screenshot of Automation and Audit Log4.jpg

Bridget Caci April 10, 2024

For reference, here is a screenshot of Auto-985.

screenshot of test ticket.jpg

Kalyan Sattaluri
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.
April 10, 2024

Hello @Bridget Caci 

As @John Funk has mentioned, you have a typo in your compare of If condition :p

Please revise it to:

{{issue.customfield_13901.jiraDate}}

And you did great with the log. Always log values so you know what values they hold.

Hope it helps and accept answer so it benefits others in the future. Thanks!!

Bridget Caci April 10, 2024

This is perfect!  This is exactly what we needed - adding the log statement and fixing the typo.  We ran several tests and it worked properly each time.

Thank you all so so much for your help!

Like # people like this
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

Great! Glad it worked out. 

0 votes
Answer accepted
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

Hi Bridget,

Can you share the actual rule? That will help us to troubleshoot it. 

And also the details of the audit log when it runs. 

YY Brother
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

Hi John,

It seems the two dates comparing is not correct:

And:  Compare two values: Checks if {{issue.customfield_13901-val}} equals {{issue.Created-val}}

Thanks,

YY哥

0 votes
YY Brother
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 10, 2024

Hi @Bridget Caci 

Welcome to our community. Please try it and refer to this link for more details:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

image.png

Hope it helps. Thanks,

YY哥

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events