Activity Forums Salesforce® Discussions Difference between Process-builder and trigger in Salesforce?

  • Difference between Process-builder and trigger in Salesforce?

    Posted by Anuj on April 22, 2020 at 1:19 pm

    What is the main difference between Process-builder and trigger in Salesforce?

    MOHIT replied 4 years, 8 months ago 3 Members · 2 Replies
  • 2 Replies
  • Udit

    Member
    April 22, 2020 at 2:15 pm

    Anuj, with the help of process builder, we can perform the following actions:

    1. Create and update records.
    2. Send an Email alert.
    3. Submit a record for approval.
    4. Invoke a process from another process.
    5. Launch a flow.
    6. We can call apex methods.
    7. Post to chatter

    Process builder is bounded to perform only these actions, If we want to perform any other action than above, we use a trigger. We can customize anything in Salesforce using a trigger. Deletion of a record is not possible via process builder and workflow but with trigger, we can delete a record.

  • MOHIT

    Member
    April 22, 2020 at 2:15 pm

    1. Process Builders cannot handle before DML It executes after a record has been created or updated. Whereas Apex triggers can handle both before and after DML operations.
    2. Process Builder cannot handle delete and undelete DML. Whereas Apex triggers can handle all DML operations.
    3.Validation: Processes do not trigger validation rules and can, therefore, invalidate data.
    An error reported in Process Builder is more generic which makes it difficult to find the origin of the error. With Apex triggers, exception handling can be made more specific.
    4. It is all or none in case of Process Builder failure. But with Apex triggers partial success is possible.
    5. Whenever a particular use case is not possible using Process Builder, consider using Apex triggers. For example, consider the below use case:-
    A custom field on a Parent object which is based on the field related to the max (roll-up) among the child records. Since roll-up functionality involves insert, update, delete and undelete operations, using an Apex trigger is the best option in this scenario.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos