add options to select list using groovy

Sumit Kumar
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.
January 21, 2014

I want to configure groovy as a service and read values from a file.

Based upon the values I wanted to add options in a select list type custom field.

is it possible ? if yes .. How ?

Thanks in advance,

Sumit

3 answers

1 accepted

4 votes
Answer accepted
Henning Tietgens
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.
January 21, 2014

I think, you could take a look at the built-in script to add values to custom fields, to see how you can add options to custom fields. The OptionsManager is the interesting point.

But you have to be aware that you shouldn't delete Options which where in use (if this is possible at all). You can delete unused options and deactivate used options if they should not be available anymore. So you have to implement some kind of "sync" between your file and the available options...

Sumit Kumar
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.
January 28, 2014

Hi Henning,

i am not finding reference code anywhere for bulk import custom field value function anywhere{which can help me save some time}.

Can you please share the code, so that it can help me in writing a new one ?

Thanks and regards,

Sumit

Henning Tietgens
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.
January 28, 2014

If you go to the script runner builtin scripts page, select the script "Bulk import custom field values" there is a link "View source". In the doScript method is a part where new options are created, see optionsManager.createOption() or https://answers.atlassian.com/questions/44051/how-do-i-add-options-to-a-select-list-custom-field-programatically

Like Federico Scheu likes this
Sumit Kumar
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.
January 28, 2014

Thanks a lot ... I think this will help.

0 votes
Mizan
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.
January 21, 2014
Sumit Kumar
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.
January 21, 2014

This is not related to what I am looking for.

Thanks,

Sumit

0 votes
Sumit Kumar
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.
January 21, 2014

for example ... say I have read a , b, c, d, e & f from the file and I want to create these as option in the select list.

Thanks,

Sumit

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events