Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best approach to populate a Jira Select List with dynamic data

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 Champions.
September 21, 2021

Dear all,

We have a custom field named for instance List Of BD which is a single select list box. Usually we configure that list with static data directly from the configure section of the field.

Now in our new case, those data are coming from an external source that we have access to which render a list of DB in an array.

What we are looking for is the best way with script runner script to add those value to the list if it is not existing already.

What is the proper way to do this ? sample will help

regards

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Alejandro Suárez García
Atlassian Partner
February 23, 2019

Hi @Andrew Henders  , you cant, unless that user is added in Jira.

Regards

Andrew Henders
February 24, 2019

Thanks for the reply Alejandro. Only an email address, of users already in the JIRA internal directory, would be used.

This thread seems to contain some scripts that may get me there - https://community.atlassian.com/t5/Answers-Developer-Questions/How-do-I-add-a-specific-user-as-a-watcher-using-script-runner/qaq-p/569185

Could anyone please suggest a change to the below script that would allow the use of the user account email address instead of user name?

 

import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.MutableIssue

import com.atlassian.jira.user.ApplicationUser

MutableIssue issue = issue

def cfManager = ComponentAccessor.getCustomFieldManager()

def watcherManager = ComponentAccessor.getWatcherManager()

def cf = cfManager.getCustomFieldObject(“12046”)

def u1 = issue.getCustomFieldValue(cf) as ApplicationUser

watcherManager.startWatching(u1, issue)

 

Please note, I'm getting an error when running the above script but seems to be close to what I would require.

Any assistance appreciated.

Cheers,

Andrew

TAGS
AUG Leaders

Atlassian Community Events