How to change custom field type with ScriptRunner? Edited


I have introduced a custom field from an add-on I no longer expect to use, but this custom field has already been added in screens and also in many ServiceDesk request types.

I would like to "switch in-place" this custom field to a standard custom field (Text single-line) so that its identifier ID remains the same to avoid to rework all screens and request types.

I expect it should be possible with Script Runner, live in JIRA without restart, as far as a re-index is triggered after operation I guess. (you understand I am not interested in known KB referring to SQL updates and JIRA restart)

May you please help to design a script to operate such a custom field type switch?

Thank you in advance

2 answers

1 accepted

1 vote
Accepted answer

Jira itself cannot change the custom field type, so there's no API for Script Runner to call to in order to change it.I would add the new field, then

    script something to read the old one into the newscript something to find where the field was used and add the new one (not replace, the API doesn't support that either)delete the old field (which will remove it from everywhere)

I'd say that your best bet is to create a new customfield, copy all values from the old field to the new and then go through all the schemes, screens and such, adding the new field (and removing the old) as needed. 

I thought about it but it is error prone. And scripting with JIRA CLI may be longer to design, with doubt ServiceDesk request type fields are handled...

I am simply curious to know if script runner is able to do it...

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 16, 2018 in Jira

Looking for anyone who made the switch to Data Center

The Jira Marketing team is putting together an ebook on migrating to Data Center. We're looking for pro tips on how you staffed your project team and organized your Proof of Concept. Share yo...

1,172 views 15 10
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