Bulk Import Custom Field Values using Script Runner not preserving order

I have installed script runner from:

https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner

and I am using the Built In scripts to bulk import custom field options for a Select List as explained in:

https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-BulkImportCustomFieldValues

The problem I am facing is that after the script runs and imports the options, in the Single Select the options arent in the order I provided during the import.

For example, this is the list I provided during import:

Alpha - A

Beta - B

Development - D

Early Install - E

Limited Production - L

Production - P

But this is the order of options I see after the import:

Alpha - A

Beta - B

Production - P

Early Install - E

Limited Production - L

Development - D

When I have more than 30 options, the order of the options is even more random.

How do I make sure that the options in the Single Select are in the order I provide during import using Script Runner?

2 answers

1 vote

I agree with Fahd that this is a bug, but not necessarily that you should create a ticket before establishing it is a bug. In this case though I think it is, although imho com.atlassian.jira.issue.customfields.manager.OptionsManager#createOption should respect the order of creating and not insert them randomly.

I think your best bet is just to import them then sort them alphabetically, which imho is always clearer for users than a custom ordering.

Unfortunately there are situations when sorting alphabetically doesn't fit, like weekdays, months etc. :(

0 vote

Hi Ashok,

I would highly suggest that you raise a ticket in the plugin's issue tracker to address this issue to its developer - https://jamieechlin.atlassian.net

I believed this is something that need to be fixed within the plugin's codes itself.

Regards,

Fahd

Hi Ashok,

Can you provide me the code for

Bulk Import Custom Field Values function.

thanks in advance.

Regards,

Sumit

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

807 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you