Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How can I use issue picker and only show issues within the project selected? Edited

Context:

I am trying to recreate the "Epic Link" or "Component/s" or "Fix Version" like experience on a scripted field.

 

Docs: https://scriptrunner.adaptavist.com/5.5.0/jira/script-fields/issue-picker.html#_usage solves the first part of the experience below but not the second.

 

Experience:

As a user, I want to be able to start typing in something like "Foobar" and a list of issues that have "Foobar" in the text to start showing up in a drop down list (similar to the Epic Link experience and include the "None found" option), so that I can quickly find the issue I am looking for in the project.

As a user, I want to be able to restrict the search in the JQL by the current project (similar to the Component/s Fix Version functionality; most of the JQL search query examples have been "project = XXX"), so that I can only see the relevant issues to the specific project. 

As a user, I want to be able to see the key of the issue I selected in the field, so I know that I selected the correct issue. This would also allow it to show up as a free text searcher and in issue navigator.

 

Things I was thinking of:

project in projectMatch(<issueKey>) but I don't know how to extract that / if that would work. 

 

Semi okay experience:

project in recentProjects()

 

Some other documentation I have been researching:

https://scriptrunner.adaptavist.com/5.4.47/jira/recipes/misc/running-a-jql-query.html

https://scriptrunner.adaptavist.com/5.0.4/jira/scripted-fields.html#_jql_searches_in_script_fields

 

Potentially doing this and the top doc of issue picker may work:

https://community.atlassian.com/t5/Jira-Software-questions/How-to-restrict-a-project-picker-selection-list/qaq-p/799441

 

Does anyone have any suggestions?

 

Edit: Added a mixed solution of using the scripted field and behavior. Is that the best solution?

1 answer

1 accepted

1 vote
Answer accepted

After talking with @JamieA at Summit19 - he provided me with a solution.

 

Step 1:

Create the custom field with the issue picker: https://scriptrunner.adaptavist.com/5.5.0/jira/script-fields/issue-picker.html#_usage .

 

Step 2:

Create a behavior for all projects (or just the projects you care about) and potentially the issue types you care about.

Inside the initializer add:

getFieldByName("Picker").setConfigParam("currentJql", "project = ${issueContext.projectObject.key} and <insert the rest of your query>") 

 

Note: Unfortunately you have to hard code the query in both places. You technically don't need to hardcode it in step 1, but you should because of the second points below. 

Note: Unfortunately there isn't a "getConfigParam" to get the current JQL. I mentioned this to Jamie and he may fix it.

Note: Ideally issue picker would just support something like {issue.project.key} in the query. I mentioned this to Jamie and he may fix it.

Who is Jamie and is there a ticket to vote on that it really happens?

Jamie is/was one of the lead developers for Script Runner (he was the creator of it before it was bought out by Adaptavist). 

I don't know if there is a ticket for this, but the workaround above is still valid. Feel free to create a support ticket with Adaptavist and post it here (if they have a public tracker).

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Asked in Jira Service Desk

Calling all Insight users, we need your help!

Hello Insight users,  As part of our (Mindville's) acquisition by Atlassian, our training team is looking to build some new Insight training materials. It would really helpful if you can ...

54 views 0 0
View question

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you