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?
You cannot do it in a change set AFAIK.
The process would be to:
- Comment out the use of the field in all code in production
- Change the field in production
- 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:
Comment out references in the Dev sandbox
Change the custom field type (my change was from Text to Text Area)
Restore the references
Create a change-set including only the changed custom field
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