1

I need to change the field type of custom field from Text to Text Area (Long). I have around 2000 records for an object requiring this change. I also have apex and visualforce code referring to the custom field that requires change of type. I plan to 1. comment apex and visualforce code accessing the field 2. change field type 3. uncomment and update the code to work with new type.

The question I have is, should I be doing step #2 above directly in Production environment using point & click or should I be doing this using change sets ? I came across below note from the documentation -

"Changing a custom field type may require changing a large number of records at once. To process these changes efficiently, your request may be queued and you may receive an email notification when the process has completed."

based on above note, does it make sense to do this field type change (only Step # 2 above) directly in production (point & click) ?

any insight on this would be very helpful

3
  • As an alternative you could create a new field migrate the values then amend the code, then delete the field.
    – Girbot
    Commented Aug 28, 2014 at 21:21
  • I love the idea of having a new field, unless you are sure you are the only one accessing the field I will not delete/ modify the field because of code dependencies
    – Rao
    Commented Aug 28, 2014 at 21:23
  • I anyways have to amend the code.If I introduce new field, data migration will be additional code (anonymous apex) that I will have to write. so I want to just work with existing field.
    – apn
    Commented Aug 28, 2014 at 21:25

1 Answer 1

1

Here is the process for this. It's painful and I've had to do this many times.

  1. Backup your Object Records Data into Excel, Backup Database, ETC. Backup your Salesforce Configuration (Metadata) using Force.com IDE or similar tool.

  2. Comment All References to the field in your metadata (Apex Code / Visualforce / Workflows /etc) in Sandbox.

  3. Change Field Type in Sandbox.
  4. Deploy modified metadata from Step 1 from Sandbox to production.
  5. Uncomment code / metadata / etc from Step 1 and modify as needed for new type.
  6. Deploy modified metadata from Step 4 into Production.

I always do this in the Force.com IDE as that is my preference, Change Sets are a bit cumbersome in my opinion. But you can use the Change Sets in Steps 3 and 5 to deploy.

1
  • 1
    Note: You can't comment Apex Code in Production so you have to do deploy process in case you were wondering. Commented Aug 28, 2014 at 21:23

You must log in to answer this question.

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