Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to use automation to link records with same value in custom field

Todd Skelton December 28, 2023

I have a custom field (Remedy_#) that exists in all of my projects.   I want to build an automation that links issues that have the same value in that custom field. 

 

I've spent some time trying to get the automation to work, but the issues are never matching the condition. 

 

Screen shots show what I have and what my results are, yet all of those issues have matches in the custom field I'm trying to link based upon:Linking Automation.PNGLinking Automation Result.PNG

Thanks for any help you can provide.

 

3 answers

2 accepted

4 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.
December 28, 2023

Hi @Todd Skelton 

Short answer: the rule you describe may not be possible as it appears to span multiple projects, and because automation rules have a processing limit of 100 issues for triggers it may never update some issues.

 

Longer answer, and some work-arounds:

The way your rule is written, the condition compares issues to themselves and then tries to link them.  And the condition may be failing because there is a typo in the smart values. 

Looking at each of these things first:

Your rule appears to use JQL with a scheduled trigger.  In automation rules, the meaning of {{issue}} changes based on where you are in the rule.  But for your case, {{issue}} and {{triggerIssue}} will be the same as there is no branching in the rule.  So we would expect the condition to always pass as "true".

 

However, the smart value for the trigger issue is {{triggerIssue}} and not {{triggerissue}} as you have used.

Smart values are name, spacing, and case-sensitive.  And often the smart value does not match the displayed field name on the issue views.  When an incorrect smart value is used, it often evaluates to "null" and fails silently.  And so your rule condition may be comparing a value to "null".

Next, it is likely the smart value for your field is not {{issue.Remedy_#}} as that has what appears to be an invalid character for a smart value.  The how-to article below helps to identify the correct smart value (and custom field id) for any supported fields for automation rules.

The essential steps are:

  • identify an issue which has your field(s)
  • call a REST API function with a browser to search for your issue:
https://<yourinstanceurl>/rest/api/2/issue/<issuekey>?expand=names
  • search on the page for your field, such as with CTRL-F
    • if you find the field, you will also find the smart value, custom field id, and structure / attributes it has
    • if you do not find the field, it is not supported by automation rules

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

 

Once you have found the correct smart values, the rule could still run into processing limits.  And so a work-around would be to only run the rule for issues with a value in your Remedy_# field and which have no issue links.  Then walk any related issues to add links when needed.

  • scheduled: with JQL to find issues with a value for Remedy_# and no issue links.  I recommend creating this JQL first, using an issue search, and test it before using it in the rule
  • branch on JQL: now with additional JQL, find issues which match the trigger issue's Remedy_# value and which are not linked to it, using as using the advanced JQL function linkedIssues() https://support.atlassian.com/jira-software-cloud/docs/jql-functions/#linkedIssues--
    • condition: any other conditions you need...
    • action: link issue to the trigger issue

 

Kind regards,
Bill

Todd Skelton December 29, 2023

Thanks Bill.  Wow, what a thorough response!  Fixed the typo. But still not working. I'm not worried about hitting the limit as my automation JQL searches only for issues with a value in Remedy_# created within the last 24 hours. 

In trying to find the correct smart field name, very little is being returned:

 

<status>
<status-code>404</status-code>
</status>
Wondering whether the underlying issue is what you mentioned...not being able to look at issues across projects...would that be true for a global automation?
Trudy Claspill
Community Champion
December 29, 2023

The URL you are using  (shown in the uri statement above) to get the field names is incorrect. It is missing the question mark between the Issue Key and "expand=names"

rest/api/2/issue/<issuekey>?expand=names

Like Bill Sheboy likes this
3 votes
Answer accepted
Trudy Claspill
Community Champion
December 28, 2023

Hello @Todd Skelton 

What is the field type for the Remedy_# field?

What are the details of your rule trigger?

In your rule, in the comparison step you are trying to compare the values of the fields in, apparently, two different issues referenced by the {{issue}} and {{triggerIssue}} smart values. However, with the way your rule is structured, {{issue}} and {{triggerIssue}} are actually the same issue.

When you use a Scheduled trigger with a JQL each of the actions that follow the trigger in your rule will be executed for each issues found by that JQL. There is no trigger issue, really, because the rule is not triggered by an action that occurs on individual issue.

 

I'll be able to offer more specific suggestions after you tell us the field type of Remedy_#, and the details of your Trigger component.

Todd Skelton December 29, 2023

Thanks for the reply.  Fixed the typo, but still an issue.   I'm wondering if the remaining issue is that the automation is looking only at the current issue and not all issues that exist that have a value in Remedy_#.  The field is a Text Field (single line).

0 votes
Todd Skelton December 29, 2023

Thanks all.   Was able to get this working...just had to tackle the automation in a branch so that it was looking at more than just the current issue. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events