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
sundar s 24sundar s 24 

delete field

what are the precautions i have to take before delete the field in production
ShivankurShivankur (Salesforce Developers) 
Hi Sundar,

Following are some notes to be considered before deleting a field:

1. Before deleting a custom field, consider where it’s referenced. You can’t delete a custom field that’s referenced elsewhere. For example, you can’t delete a custom field that’s referenced by a field update or Apex.
2. You can’t delete a field if that field is being updated by a background job, such as an update to a roll-up summary field. Wait until the background job finishes, and try again.
3. When you delete a custom field, all of the field history data is deleted and changes are no longer tracked.
4. A background process periodically runs that cleans up metadata associated with deleted custom fields. This process will affect the Last Modified Date and Last Modified By fields on page layouts, record types, and custom objects.

Reference:
https://help.salesforce.com/articleView?id=deleting_fields.htm&type=0

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Thanks.
sundar s 24sundar s 24
  Shiva
          If the field is used in integration or code and if i try to delete then system will prompt and it wont allow to delete right? 
i no need to worry abt data and it will automatically vanish . correct me if my understanding is wrong
ShivankurShivankur (Salesforce Developers) 
Hi Sundar,

If the field is used in integration or code and if you try to delete then system will prompt and it wont allow to delete, yes that's true.

Also note that deleted custom fields and their data are stored until your org permanently deletes them or 15 days has elapsed, whichever happens first. Until that time, you can restore the field and its data.

You can learn more about it here:
https://help.salesforce.com/articleView?id=sf.fields_managing_deleted_fields.htm&type=5

Hope above information helps. Please mark as Best Answer so that it can help others in future.

Thanks.
sundar s 24sundar s 24
Shiva
          Thanks for your quick reply ,in pagelayout i no need to take care and it will erase including label or i have to rmeove manually in pagelayout? 
Suraj Tripathi 47Suraj Tripathi 47
Hi Sundar,

If you want to delete any field before this deletion makes sure it is not used in any record else it creates the problem.
make sure that field is not a standard field.
This type's point you should remember.
You can learn from this :
https://help.salesforce.com/articleView?id=sf.deleting_fields.htm&type=5
https://help.salesforce.com/articleView?id=sf.fields_manage_deleted_fields_classic.htm&type=5

---------------
If you find your Solution then mark this as the best answer to close this question. 

Thank you!
Regards,
Suraj Tripathi