Jira ScriptRunner - How to make a Pick List Scripted Field

Roberto L
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.
November 2, 2017

Hello Community,

I am trying to develop a Scripted Field in Jira.

My requirement is a Scripted Field that returns in a pick list format the issue key's of all the issues of type Epic.

For example:
I have 5 Epics: PT-2, PT-3, PT-6, PT-7. and PT-10.

I want the scripted field to be a pick list with the keys of such issues.

Has anyone attempted to do this before that could provide me with some insight into this.

Any help is appreciated!

-Roberto

1 answer

1 vote
Steven F Behnke
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.
November 2, 2017

You cannot do this with a script field. Script fields are READ ONLY and do NOT SHOW UP on Edit / Action screens. Period. Ever.

Please read up on Behaviors and how you can accomplish this: https://scriptrunner.adaptavist.com/4.3.1/jira/behaviours-conversions.html

Roberto L
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.
November 2, 2017

@Steven F Behnke,

I read the link about Behaviors and that seems like it could be a solution.

May I ask you a question though, what I ultimately want to do is use the scripted field in a dashboard as a dynamic filter.

I have this issue that in one of my Jira Dashboards I want to filter down by a specific attribute (the key of an issue type) that isn't a field in Jira. 

I tried to fix this by making static filters from JQL queries and that worked but now I have a lot of keys to filter on and making a static filter for each one isn't feasible.

To solve that issues my idea was to use a scripted field that would return a list of keys for certain issues that I retrieved via JQL query. Since I know now that script fields are read only and can not be selected. What would you recommend I do for such problem I am facing.

Thank you!!

-Roberto

Steven F Behnke
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.
November 2, 2017

Can you give me an example? I'm having a hard time following the example.

Roberto L
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.
November 3, 2017

@Steven F Behnke,

I have an issue type called Planview, In Jira I have 5 Planviews in existence:

Planview-1, Planview -2,... Planview-5.

My Jira issue hierarchy goes Planview > Epic > Story > Subtask. Therefore a specific Planview will have quite alot of children underneath it.

I have a dashboard that shows the overview of Jira, all the issues, its hierarchies, etc.

As I mentioned before my dashboard works perfectly, with the only issue being that I have way too many static filters to filter down what is under every Planview.

Below is the code I use to display everything under a specific Planview. I grab the Epics, Stories, and subtasks underneath a specific Planview when filtered down.

issueFunction in linkedIssuesOf("issuetype = Epic AND 'Parent Link' = PLANVIEW-1", "is epic of") OR issueFunction in  subtasksOf("filter = 'PLANVIEW-1 Filter'") OR issueFunction in epicsOf("filter = 'PLANVIEW-1 Filter'") OR issueFunction in portfolioParentsOf("issuetype = Epic AND 'Parent Link' = PLANVIEW-1")

Like I said I, currently have 5 Planviews and in the future it will grow to the 100's. When that happens making a static filter for each Planview number wont be feasible.

I want to know if there is a way to create a pick list of sorts where I can add the JQL for every Planview and when I click on it a drop-down displays with all the available options.

I had heard that a Scripted Field could be used, but that is all that I had heard. 

I hope that makes more sense.

Thank you Steven!!

-Roberto

Suggest an answer

Log in or Sign up to answer