How to choose between Trigger and Lightning Process Builder
With the introduction of Lightning Process Builder, we can do many things which were kind of limitations of Workflows. Salesforce introduces Lightning Process Builder as successor of Workflow rules, thus allowing more config options through click and reducing amount of apex customization required. Process Builder supports all the features from Workflows with the exception of sending outbound message without apex code. I will not be surprised if Salesforce decides to decommission Workflow in near future.Previously there were few scenarios (listed below) which were not possible through workflow and we need to write Apex trigger to achieve those. Here are few of them -If we need to perform complex validationBefore/After logic for record insert/update/delete/undelete operation.Update/insert any objects or related records.Problem with workflow is we can’t update child records with workflow. Workflow supports only updation of parent record. So earlier we need to go for Trigger. But with the introduction of Process Builder, now we can update child records as well. Below is one case study -Case Study:It’s a library management system – Universal Library. Library is having many books. If the book is not available, user will send the request for the book. The moment book is available, all the request status will change from ‘Hold’ to ‘Ready to Pickup’. To achieve this below is the object model -Here Book and Book Request are connected through Master-Detail relationship. Previously to...
Read More