Activity Forums Salesforce® Discussions How to change field type if the field is referenced? 

  • How to change field type if the field is referenced? 

    Posted by Saddam on October 21, 2019 at 9:39 am

    How to change field type if the field is referenced?

    Nikita replied 5 years ago 2 Members · 1 Reply
  • 1 Reply
  • Nikita

    Member
    October 21, 2019 at 1:32 pm

    Hi Saddam,

    There are two ways to get this done that I know of. Assuming you're working primarily in a sandbox:

    • Comment out all the lines with that field in it in all classes and triggers.
    • Modify the field.
    • Deploy all the changed code and metadata to production
    • Uncomment all those lines of code
    • Deploy all the changed code to production

    or

    • Make a new field with a new name.
    • Change every reference in your code to that new field.
    • Deploy changed code and new metadata to production
    • Move over any data from the old field to the new field

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos