Automation for Jira - linking based on field comparison

David Loszewski January 6, 2020

Hello,

I'm trying out Automation for Jira to hopefully solve a problem that I have.  As Jira cloud does not have a lookup field I'm trying to find a way around to link issues between projects.  

I currently have two projects: 1 called Customers that has a list of issues and the summary of each issue has a customer name. The other Is a service desk which has a pre-populated customer number field. 

What I would like to do it create an automation that will link the issue in Customers if the customer number field matches the one in the Customer.    

With SharePoint all I would have to do is create a lookup field to a table and it would automatically be linked.  

Thanks.

2 answers

1 accepted

0 votes
Answer accepted
frother
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 6, 2020

Hi David,

Thanks for reaching out. Yes you can do this by using a JQL branch with a smart value, for example:

project = "Customer" and "Customer number" = "{{issue.Customer number}}"

You will need to ensure the project & field names of course match the ones on your instance exactly. Also this will need to be a global rule, as it deals with multiple project. The complete rule would look something like this:

Screen Shot 2020-01-07 at 5.13.17 pm.png

Hope that helps.

Cheers,
Scott.

David Loszewski January 8, 2020

Thank you.  

Is there a way to tell if the smart value that I choose will work?  The validate query button is grayed out for me and when I run that rule it does not trigger currently.  Trying to figure out how I can debug.  

David Loszewski January 9, 2020

OK, I got it working, my apologies, looks like I hadn't added it as a Global Rule but instead a project rule.  I think I need some more understanding between the difference of the two. 

Schneur Kamensky March 16, 2022

Project rule will be limited in scope to a single project.

Global is for rules that involve or communicate with multiple projects.

Diogo Rodrigues June 12, 2023

I'm in cloud version and I dont have that "For JQL" option? How do I get that?

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 8, 2020

Hey David - is the Customer number field actually defined as a number field or is a text field? If it is a number field that should work. If it is a text field, then try using the ~ instead of =

David Loszewski January 9, 2020

the customer number field is a Select List (single choice)

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2020

So maybe try the ~

:-)

David Loszewski January 9, 2020

Tried the ~ and get the following error in the Audit log: 

Error searching for related issues. This is most likely because the following issues don't have a related issue of the type you specified. Try narrowing your search to only include issues that contain links to related issues:AT-4: "((project = "Customers" and "Customer Number" ~ "37258") AND (key != AT-4)) AND (project in (10026))" - The operator '~' is not supported by the 'Customer Number' field.

David Loszewski January 9, 2020

Image 133.png

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2020

Well, guess that answers that. But when you use the = sign, you get no error, but it doesn't return values as you would expect?

David Loszewski January 9, 2020

Correct, if I use the = sign I get the "No action performed" 

 

Image 134.png

David Loszewski January 9, 2020

n case you were interested in what kind of data is in the customer number custom field.  

 

David Loszewski January 9, 2020

It may also be good to know that if I put the following into an advanced JQL search in Jira, I do get the results I am looking for: 

 

project = "Customers" and "Customer Number" = "37258"

 

I want the issue in Jira, to be the Parent issue, does that make a difference in my Then: rule? I guess in either case it should be able to find the issue and link to it.  

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 9, 2020

Glad it is working for you. Good to know about the Global Rule. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events