I have a field in two sandboxes with the same ID (they both came from production). The field is on the Opportunity
Let’s call them sandbox1 and sandbox2.
I changed the API name of the field in sandbox1 (along with some apex references).
But when I deployed the change set from sandbox1 to sandbox2, instead of changing the API name in sandbox2 to match the API name in sandbox1, it created a new field with the changed API name and left the old field intact and unchanged.
Is it possible to rename API names of fields with change sets? Or will is always create a new field when I move it from one environment to another?
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
The API names are, in a matter of speaking, the unique Id’s for your metadata. If you change the API name in sandbox 1, sandbox 2 has no idea that you did that. So when you move the metadata to sandbox 2 it thinks it is a new field.
So to answer your question. No you can not rename API names with change sets.
If you need to do something like that I would suggest using the force.com ant migration tool to first delete the old field then insert your new(renamed) field.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0