Can I rename API names of fields in a change set?

All we need is an easy explanation of the problem, so here it is.

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?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

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.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

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

Leave a Reply