Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,398
Community Members
 
Community Events
165
Community Groups

How to populate a dropdown list before issue creation

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

0 votes

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).

@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

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. 

@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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

277 views 2 5
Read article

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