Need a help in writing Automation Rule

Swati Mathapati June 22, 2022

I would like an automation rule ensuring that: If a number entered in the field "document number”, matches a number already entered in this field in an existing task, then the two tasks will be linked.

Document number is the custom field.

 

I have written a rule and its not working , can anyone tell me where I am failing?

 

Automation rule.PNG

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.
June 22, 2022

Hi @Swati Mathapati -- Welcome to the Atlassian Community!

When you note the rule is not working, what do you observe happening?  What do you see in the audit log when the rule runs?

Until we see that information...Two possible improvements to your rule could be:

  • only trigger the rule when your custom field is updated
  • modify your JQL to exclude the trigger issue's key; otherwise it could try to link to itself

Kind regards,
Bill

Swati Mathapati June 23, 2022

Hi Bill ,

Thank you for your prompt response. I get the below error after running the rule

Error.PNG

Regards,

Swati

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

Yes, that error matches what I noted earlier.  Please add this to your branch JQL to exclude the trigger issue:

AND key != {{triggerIssue.key}}
Swati Mathapati June 27, 2022

Hi Bill,

Here is the JQL query and it does not work. Do we need to include Document Number there ?

Project = PSTS AND Issuetype in ("Case Lead Task", "Technical Writing Task") AND "Document number" ~ {{issue.fields.Documentnumber}} AND key != {{triggerIssue.key}}

Regards,

Swati

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.
June 27, 2022

Sorry I missed this earlier, as your JQL is incorrect: it is comparing issues to themselves...Within a branch {{issue}} refers to the branching issue and not the trigger issue.  Please try this for your JQL:

Project = PSTS AND issueType IN ("Case Lead Task", "Technical Writing Task") AND "Document number" ~ {{triggerIssue.Document number}} AND key != {{triggerIssue.key}}

And if that not work, please use this how-to article to find the custom field ID for "Document number" and substitute that instead of the field name:

https://support.atlassian.com/cloud-automation/docs/find-the-smart-value-for-a-field/

Swati Mathapati June 29, 2022

Hi Bill,

 

Thank you so much! it is very much appreciated.

It worked.

 

Regards,

Swati

Like Bill Sheboy likes this
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.
June 29, 2022

I am glad to learn that helped.  Please consider marking this question as answered; that will help others in the community find possible solutions for their own needs faster.  Thanks!

Suggest an answer

Log in or Sign up to answer