Forums

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

Script Runner Groovy script to rename fields?

Chris Scheepers
Community Champion
December 21, 2022

Hi Team,

 

Is there a sample script that I can use to rename a list of custom fields using script runner ?

 

Your assistance would be greatly appreciated !!!

 

Thank you 

 

CJ

2 answers

1 vote
Vamsi Kandala
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.
December 21, 2022

Hi @Chris Scheepers

You can use 'Behaviors' option in ScriptRunner and add this code in the 'Initialiser' block.

Make sure you map the relevant projects and issue types accordingly to this behavior.

Code:

def custom_field = getFieldById("customfield_xxxxx");

custom_field.setLabel("Whatever name you want to call this");

 Note that this custom field will show the renamed value only in 'Create' and 'Edit' screens.  It will be displayed in its original label/ value in the View screen.

Hope this helps.

Thanks,
Vamsi

0 votes
Pavan Kumar Pinniboyina
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 17, 2025

For Jira Cloud

getFieldById("customfield_XXXXX").setName("Desired field name");

Suggest an answer

Log in or Sign up to answer