It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

how to make custom field ID same in all the instances

Hello,

I would like to know if there is any way that i could change the custom field ID.

For my DEV instance, if i have a custom field ID as 123456. When i import my project configurations to PROD, the custom field ID changes to some random number.

Was thinking of changing all my custom field ID's (around 500 custom fields) to make it same as in PROD. Because whenever I write a script, I need to change the values in it again in PROD.

Can someone help me with this.

 

Thank you

2 answers

1 accepted

1 vote
Answer accepted

hello @Nani .
unfortunately from my understanding, what you are trying to do is not possible. The custom field id is auto-generated and yes you can have a mismatch between the prod and the dev.

what we usually do before developing a new feature/script in dev is we update the data of the dev by the data of prod to align the ids and go from there.

another solution would be to use the name of the field, but you have of course to make sure that our names are unique :(...
Good luck

Hey Thanks Robert,

Could you let me know how to align the data of PROD to DEV.

 

Thanks 

Naveen

hello @Nani ,

this is the easiest way: restore from backup 

Regards

2 votes
Payne Community Leader Oct 04, 2019

I have handled this issue in two ways: by identifying fields by name rather than ID, and by referencing ID based upon the environment.

e.g.

def cf = ComponentAccessor.customFieldManager.getCustomFieldObjectByName("Customer Request Type")

or

boolean devEnv = ComponentAccessor.getApplicationProperties().getString("jira.baseurl").indexOf("jira-dev.MYDOMAIN.com") > -1
boolean testEnv = ComponentAccessor.getApplicationProperties().getString("jira.baseurl").indexOf("jira-test.MYDOMAIN.com") > -1
boolean prodEnv = ComponentAccessor.getApplicationProperties().getString("jira.baseurl").indexOf("jira.MYDOMAIN.com") > -1

at the top of my script, and then

Long linkTypeApprove = devEnv ? 10600 : (testEnv ? 10700 : (prodEnv ? 10850 : 0))

Hey Payne,

Does this help if we have different fields with the same name?

 

Thanks

naveen

Payne Community Leader Oct 04, 2019

If you have 2 or more fields with the same name, you'll want to use the second approach. I'd try to avoid that situation, though, as that could cause headaches with JQL and possibly other areas.

Sure thanks,

Will try it and update you.

 

-Naveen

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

303 views 1 3
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you