Get a list of issues based on key being a field name in another project, but tickets are not linked

Manoj Japher April 30, 2024

Hi,

 I would like to get a list of issues from project A with condition that the key for the issue is a field name in another project B. But the 2 tickets are not linked. 

Project A: Sample ticket "PROJA1234"

 

Project B: Sample ticket: "PROJB5678" has a field called "Altkey" with a value "PROJA1234".

Both tickets are NOT linked.

I need a list of ticket from Project A which matches the criteria that they are listed as a value in that field on Project B tickets

 

I tried the following, didn't work

project = "PROJA" AND type = Task AND issueFunction in issueFieldMatch("project='PROJB' and type=Task", "Altkey", "PROJA*")

 

Tried with both issueFieldMatch and issueFieldExactMatch, no luck.

Can anyone help?

2 answers

0 votes
Harpreet
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2024

Welcome to the Atlassian Community..!

The issueFunction option in JQL is provided by ScriptRunner for Jira by Adaptavist and is not part of Jira's default functionality.

 

I hope you are using the JQL Keywords in the Enhanced Search screen under Apps > Enhanced Search or within Jira's issue navigator. You can find their documentation here:ScriptRunner Enhanced Search 

 

Moreover, you can also submit a support request to the ScriptRunner Team: Submit a Suppport Request 

 

0 votes
Matt Parks
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.
May 1, 2024

What field type is Altkey? Is it a text field or an Issue Picker field (or something else)?

Manoj Japher May 2, 2024

Hey @Matt Parks , Altkey is a Text field (single Line)

Manoj Japher May 14, 2024

@Matt Parks Does the type of the field makea difference?

Matt Parks
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.
May 14, 2024

I'm not a regex guru by any means, but I'm not sure that you can use * in your search. Take a look at the Scriptrunner documentation around the issueFieldMatch function:

https://docs.adaptavist.com/sr4js/8.23.0/features/jql-functions/included-jql-functions/match-functions

After looking at how the issueFieldMatch function works, I'm not sure it's possible to do what you want using that function.

project = "PROJA" AND type = Task  -- This will return any Task in the PROJA project

issueFunction in issueFieldMatch("project='PROJB' and type=Task", "Altkey", "PROJA*") -- This will return any tasks in the PROJB project that have PROJA in the Altkey field.

You'll never get anything from this query because you're trying to get a Task that is in both PROJA and PROJB.

 

Matt Parks
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.
May 14, 2024

This is kind of a clunky workaround, but you could have a scripted field that only runs against PROJA tasks and returns a true value if there are any PROJB tasks that have a value in the Altkey field that matches the issue key. Then your JQL could return a list of issues where that scripted field value is true.

You could also make the scripted field a mulit-issue picker list and store all of the PROJB tasks in the field, if you wanted.

I could probably write this for Data Center, but I don't know if the syntax is the same for Cloud.

Suggest an answer

Log in or Sign up to answer