function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Paul TangussoPaul Tangusso 

Replacing Formula Field with Number Field

I need to replace a Formula (type=Number) field with a straight NUMBER field.  The Formula field is referenced in a handful of reports and in one Apex class. Trying to understand the best way (steps) to accomplish this considering the restrictions associated with changing field types.
Do I attempt to change the field type or create a new field?  Any suggestions?  Thank you.    
Best Answer chosen by Paul Tangusso
VinayVinay (Salesforce Developers) 
Yes, I just checked in my org formula fields type cannot be changed.  As mentioned kindly take backup of the existing formula field and unplug formula field dependency on reports and apex class.

Load the values to new fields based on record id's using dataloader and you should be good to delete old field.

Please mark as Best Answer if above information was helpful so that it can help others in the future.

Thanks,

All Answers

VinayVinay (Salesforce Developers) 
Hi Paul,

You can try to change the data type instead of creating new field.

First, try to remove field dependencies from existing components i.e reports and apex class then make attempt to change field data type.

Also would suggest to take backup of existing field data using dataloader before you make any changes and reload once you change value.

If not create new field and load existing values from fromula to number field and use them in existing reports and class.


Hope this helps...

Thanks
Paul TangussoPaul Tangusso
Hi Vinay.  Thank you for the response.  After additional review it appears I will have to create a new field.  I read that you cannot change a Formula field to another type but rather you can only change the Formula value 'return type'.  
VinayVinay (Salesforce Developers) 
Yes, I just checked in my org formula fields type cannot be changed.  As mentioned kindly take backup of the existing formula field and unplug formula field dependency on reports and apex class.

Load the values to new fields based on record id's using dataloader and you should be good to delete old field.

Please mark as Best Answer if above information was helpful so that it can help others in the future.

Thanks,
This was selected as the best answer