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

How to populate a dropdown list before issue creation

serge calderara
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.
September 9, 2021

Dear all,

We have actually a Service Desk request where user fillup a form to sumbit the request.
On field on the form represent a drop down list with static default value that we add during the configuration of the field.

Now our goal, is to get the value of that dropdown list fetch from an API call to an Azure resource.

What is the way to run the script runner script in order that when the form gets visible to user, the list is populated correctly with fetched dynamic content ?

Thanks for help

regards

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Peter-Dave Sheehan
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.
September 13, 2021

There are 2 options

1) Have a job that runs on a schedule to fetch the source data from Azure and add/updates the options in your select custom field. When users access the form, all the data is local to jira. The data is stored in jira as "option id"

2) create a new FREE TEXT FIELD in jira, and use the scriptrunner behaviour "select list conversions" methods to present that free text field with live data from azure. The azure API is called each time the users access the form. The data is stored in Jira as free text (can still be indexed as distinct values).

serge calderara
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.
September 15, 2021

@Peter-Dave Sheehan , thanks for your reply.

I am sorry but I did not understand where and how I should cover my need based on your answer.

Just to be sure we are on same line, as I have mentionned, I have a droplist box which need to be populated at the time the user open a request from the service Desk.

When the user select the request, then the form to complete gets display to him but issue is not created until he click on create. At this staging of filling up the request form my list box drop down field should be populated from a script runner script.

I have seen in script runner that we can create a scripted field, but when selecting the type of field to script, I do not see the type DropDown List box which is what I need.

Can I do my need with scripted field ?

If yes how can I select my drop down list as the concerned field and populated it ?

I did not find any clear sample relative to that

Thanks for help

regards

Peter-Dave Sheehan
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.
September 16, 2021

I have a droplist box which need to be populated at the time the user open a request from the service Desk

What do you mean by "doplist box needs to be populated"?

  1. Do you want the list of values available in the droplist box to be adjusted dynamically from the API call?
  2. Or do you want one of the pre-configured items in the list to be selected automatically?

The term "script field" in script runner can mean many different things:

A custom scripted field is a field where the value is calculated by a script based on existing values. The calculated value is never stored to the database. Instead, it is re-calculated each time you need it.

Scriptrunner now offers many different kinds of "scripted" pickers:

  1. Issue picker - lets you select and link any issues base on a JQL
  2. Remote issue picker - let you select and link any issues from a remote jira instance using application links
  3. Database picker - lets you select any values from a database connection (configured in scriptrunner resources) using SQL to choose the values to offer in the picker
  4. LDAP Picker - let you select a record from an LDAP connection (configured in scriptrunner resources) using ldap query to choose the values to offer in the picker

As you can see, there is no standard way to create a picker from an arbitrary REST API.

For that, you must use more advanced customizations.
One of the advanced customizations that allow a dropdown field where the available options are pulled from an API is to use the select list conversion methods I linked to in the original response. 

serge calderara
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.
September 17, 2021

@Peter-Dave Sheehan based on your question :

Do you want the list of values available in the droplist box to be adjusted dynamically from the API calll ?

In fact that data that I need to fetch from Azure through API, I have no idea how often they will changed by customer.

So what I mean is that when the user have the form open, the listbox should be ready with fetched data. There is properly not necessary a need to call to web service while the form is called. I am eploring what are the best solution.

I could also have a scheduled task wich run every nights and update a custom field data.

regards

TAGS
AUG Leaders

Atlassian Community Events