Forums

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

lookup work items (issues) with the same value in a custom field as trigger issue

Ward Schwillens_ Schwillie
Contributor
May 7, 2025

Hi there,

I am trying to lookup work items with the same value in a custom field as in the same customfield in the triggerIssue of the automation.

Automation Branch high level.png

Step 1: Create smart value

I first create a smart value called {{LookupOrder}} which  contains {{triggerIssue.customfield_18631.value}}

Automation Smart Value LookupOrder.png

Step 2: Branch

Then within the branch step I am using this JQL Query:

{{issue.customfield_18631.value}} ~ {{LookupOrder}} AND parent = 'ACMEINC-104'

Automation Branch detail.png

When I execute the manually triggered rule on the trigger issue I get this error in the audit log: 

--------------------------------------------------------------------------------------------------

Branch rule / related work items05/07/2025, 17:08:04

Unable to find related work items. Try to only include work items containing links to related work items in your search:ACMEINC-104: "( ~ AND parent = 'ACMEINC-104') AND (key != ACMEINC-104)"

- Error in the JQL Query: Expecting a field name but got '~'. You must surround '~' in quotation marks to use it as a field name. (line 1, character 3)

--------------------------------------------------------------------------------------------------

 

What can I do to retrieve the work items with the same value in the specified customfield as in the trigger issue. How can I add some more JQL conditions, like the found work item key should be different than the triggerIssue - work item - key, and the parent should be a specific work item.

In the next steps I want to do some update and comment actions on the looked up issues.

Thank you very much for your insights! 🙏

 

 

1 answer

2 votes
Jaime Escribano
Contributor
May 7, 2025

Hi Ward! Let's see what we can do.

 

It would seem like the syntax of your JQL is not formatted propperly.

 

I would rephrase it as 

nameOfYourCustomField = {{LookupOrder}} AND Parent = "ACMEINC-104"

 

What you were doing was comparing the value of a variable (your first smartvalue) to the value of a different variable (the second smartvalue)

With the syntax I suggest you are making a query where "any issue whose nameOfYourCustomField contains {{lookupOrder}}"

 

As general advide, I would recommend testing your JQLs with dummy values in the "lookup work items" menu to make sure it works as expected.

 

Give it a try and let me know if that helps!

Ward Schwillens_ Schwillie
Contributor
May 8, 2025

Hi Jaime, 

Thank you for your suggestion.

How do I need to mention the customfield? 

Is specified this now in the JQL Branch: 

{{issue.customfield_18631}} ~ {{LookupOrder}} AND parent = 'ACMEINC-104'

but I get this error now:


Branch rule / related work items
05/08/2025, 18:10:08

Unable to find related work items. Try to only include work items containing links to related work items in your search:
ACMEINC-104: "(000000500394 ~ 000000500394 AND parent = 'ACMEINC-104') AND (key != ACMEINC-104)" - Field '000000500394' does not exist or you do not have permission to view it.

Thank you for your insights!

Jaime Escribano
Contributor
May 8, 2025

No worries! I can see where the confusion is coming from.

 

{{issue.customfield_18631}} ~ {{LookupOrder}} AND parent = 'ACMEINC-104'
here just write the name of your customfield.

For example if the custom field was "description" the JQL would be:

 

description{{LookupOrder}} AND parent = 'ACMEINC-104'

If you notice, "parent" here is one custom field! And you are comparing it with a value. In the same way you want to compare your custom field to the {{lookupOrder}} value :D

 

Hope that helped!

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