We need to change a field type (Number to Currency) in the production instance using a change set. And we can't change the field type directly, because there are references of those fields in triggers and classes. we can remove the references and change the field type, after that we can add all references again. Then we send that change set in to production those changes will be apply?

4 Answers 4


Firstly comment all your field references in sandbox and change the field type. Later un comment all the previously commented code. Then prepare a change set and deploy to production.

  • Do you know what will happen to existing production data in this case (e.g. if the custom field field is Number in production but a changeset deploys an update making that field Text)? Feb 10, 2016 at 20:13

It can be done using the metadata api. Flosum is the tool which automates such changes since it leverages the salesforce metadata api in the backend. It can also help with field level security and other issues that are quite hard to solve.


You cannot do it in a change set AFAIK.

The process would be to:

  1. Comment out the use of the field in all code in production
  2. Change the field in production
  3. Put the code back to the way it was

It is a stepwise process and not necessairily an easy one if the field is used in many places. Test methods using it in asserts or the field being required to get proper values is also an issue.


I just tested this from a Developer Sandbox to a Full Sandbox. It is possible to do the following:

  1. Comment out references in the Dev sandbox

  2. Change the custom field type (my change was from Text to Text Area)

  3. Restore the references

  4. Create a change-set including only the changed custom field

  5. Successfully deploy the change-set to the Full sandbox

Note the benefit of this approach is three-fold (1) you don't have to touch the apex in the target system (2) you don't have to do any data migration (3) deployment has no downtime

EDIT: Note, I have not tested this from Number to Currency, so it's possible it may not work for those data types

  • Text to text area is not an issue. Number to Currency is an issue help.salesforce.com/…
    – Eric
    Nov 8, 2016 at 20:11
  • Thank you, I have edited my answer to note that I have not tested it for those data types Nov 8, 2016 at 20:23
  • It may be possible in some types but general rule is to comment code, verify data and export it. Change field. Uncomment code. Doing via change set when field exists with data and references is not best approach.
    – Eric
    Nov 8, 2016 at 20:25
  • Can you elaborate on why that's not the best approach, e.g. in my example? Nov 8, 2016 at 20:28
  • Data Loss. In your example it is fine but the OP is asking about Number to currency. Additionally it all depends on each situation as when I have attempted to change field types via change set I always threw an error that I could not do it. You just happened to try with one of the few that you can change via change set without worry. So a general answer, unless you know what you are doing, is always the least risky. Hence best practice. Best practice is not always the easiest. If you would like to ask a question please do, comments are not for extended discussion
    – Eric
    Nov 8, 2016 at 20:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .