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
msc7808msc7808 

Override Delete/Edit routine

Hey Guys,

 

I am quite new to the Salesforce. I am working on creating a test application. I need to implement a Override routine to the Delete so that the user can;t do hard delete of record but rather flag the record as deleted.

 

I found on the set up page that we can override the Delete button however I dont know what to do next. Could you please assist by posting or directing me to an example?

 

Thanks

Manpreet

werewolfwerewolf
Are you aware that this is already how Salesforce.com works?  When you delete a record, you don't really delete it, you soft delete it -- it goes in the recycle bin and stays there for 30 days, and then it finally gets physically deleted.
msc7808msc7808

Thanks. I was not quite aware of it. Good to know.

 

However can we do the following: for an object define a status field. When a user hits the delete button, the routine is overriden with custom code which actually flags this field as Deleted. Now the System Admin should be able to review the flagged records and delete/restore those.

 

Thanks for your help.

werewolfwerewolf

Yes, just override the delete button with some custom code.  Your custom code would actually be similar to this, which also sets a status field.

 

 

werewolfwerewolf
Or you could hide the default Delete button, make a new one which is also labeled Delete, and put your custom code in that.
msc7808msc7808

Perfecto.... :)

 

Thanks for your help.