How do you lookup an issue using one of the ticket components?

Aqib.Shirwani April 14, 2023

Hi, I am trying to perform the following:

1. Take an existing Component on the ticket and perform a search with it. This component can be found with something like: {{issue.components.name}}

2. Search this component using JQL. Similar to this:

component = ADMIN order by created DESC

 

3. Post the results in a comment

I believe the searched data can be found using {{lookupIssues}}

 

I'm running into an issue with the JQL logic and am unable to search for the following:

component = {{issue.components.name}} order by created DESC

 Does anyone have suggestions on how to perform this component search using the components from the issue?

2 answers

1 accepted

0 votes
Answer accepted
Aqib.Shirwani April 24, 2023

Since my search was across multiple Projects, I was able to resolve this by getting Admin access to Jira and creating a Global Rule that allows me to search in both of my desired projects.

1 vote
Trudy Claspill
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 14, 2023

Hello @Aqib.Shirwani 

Can you please show us your entire Automation Rule? Also please show us the results of the rule execution that are recorded in the Audit Log.

When asking for help with an Automation Rule we really need to see that information. Often a problem in an automation rule is caused by the context under which the step is running.

Do your issues ever have more than one Component value? The Components field is a multiple selection field, so it is possible for there to be more than one value there. What would you expect to happen if there was more than one value?

If you look at the documentation for the smart value for Components you'll see that it returns the values that are in the field. You are getting a list of values.

To accommodate getting a list of values you need to change your JQL to

component in ({{issue.components.name}})

Aqib.Shirwani April 15, 2023

Hey @Trudy Claspill 

I've attached my automation below.

The Create Variable part was just me testing something out - I can remove it.

 

In the JQL of the lookup, I tried the lookup with the following:

  • {{issue.components.name}}
  • ({{issue.components.name}})
  • '{{issue.components.name}}'

jiraAutomationTest.png

This is how I'm displaying the values from the Lookup:

image.png

Here's what the logs displayed:

image.png

 

Thank you for your suggestions for multiple components. I will change the JQL as such: component in ({{issue.components.name}}). 

Any idea why the lookup is always displaying no issues?

Trudy Claspill
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 17, 2023

Are you saying that you are trying to display the issues found by the Lookup Issues action within the comment you are adding, and it is there that nothing is displayed?

If so, then what you have added to the comment is not correct for displaying all the issues that were found in the action.

If you look at the documentation for the Lookup Issues action it provides you with the correct syntax for display information (in the example it displays the issue key) for each issue in the results set.

 

{{#lookupIssues}} 
* {{key}}
{{/}}

Suggest an answer

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

Atlassian Community Events