Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,502
Community Members
 
Community Events
165
Community Groups

Need a help in writing Automation Rule

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

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

Hi Bill ,

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

Error.PNG

Regards,

Swati

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

AND key != {{triggerIssue.key}}

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

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/

Hi Bill,

 

Thank you so much! it is very much appreciated.

It worked.

 

Regards,

Swati

Like Bill Sheboy likes this

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you