Traditionally, within Salesforce platform, only Apex triggers were equipped to handle record delete events. For any custom handling of delete actions, one had to create and maintain Apex code. Not to mention, be mindful of the best practices of handling deletions in bulk and displaying error messages.
Salesforce flows have been graduated to now handle on delete events for objects within Salesforce. So, now you can create a flow which gets triggered on record delete.
Step by Step Guide
Let's take a sample scenario (probably most used). Let's say you want to restrict any user to delete an Account of type Customer. Following are the steps to create flow
Step 1 : Create a flow of type Record Triggered Flow
Step 2 : Set Entry Criteria
- Set Trigger to A record is deleted
- Set Entry conditions to qualify only active customer accounts
Step 3 : Add new Custom Error
Step 4 : Setup Error Message
Step 5 : Save and activate flow
Step 6 : Test and verify flow works
Tips
Error - while trying to deploy flow metadata
Solution
Re-retrieve flow (example uses flow named test) metadata using API version 59.0 or above
Comments
Post a Comment