Activity Forums Salesforce® Discussions How we can achieve dynamic approval process in Salesforce?

  • Avnish Yadav

    September 27, 2018 at 6:17 am

    It is possible through apex triggers because in standard approval process, you need to define approver while creating approval process.

  • Parul

    September 28, 2018 at 8:06 pm

    Dynamic approval routing allows you to specify the approvers for each record using User lookup fields on the record requiring approval. The fields are populated using Apex, using data from a special custom object (the "approval matrix") that contains all the information needed to route the record. The approval process then uses the values in the lookup field, rather than the limited pool of users available in the so-called static process. This provides more flexibility: you could route to different people based on region or some other criteria related to the record, rather than having to write multiple static approval processes in order to perform the same functionality.

    The steps for dynamic approval routing are:

    Create lookup fields on the object being approved.
    Create a custom object that will be used as an approval matrix.
    Populate the approval matrix.
    Create Apex code to fill in the lookup fields on the record, from the approval matrix.
    Create or update an approval process to utilize the new lookup fields.

    For example: suppose you have a position object and there are 3 levels of approvers. You need to route the record to different approvers based on the department and pay grade. You would:

    Add custom lookup fields (to User) on the Position object, called Approver 1, Approver 2, and Approver 3.
    Create an approval matrix object that stores all the fields used in routing: pay grade, department, and lookup fields to the User object for each approver.
    Create the approval matrix records. For position, one might route records with the department of Engineering to high-level Engineering managers as approvers, whereas the department of Sales would have high-level Sales managers as the approvers.
    Use an Apex trigger to populate the lookup fields on the Position record when the record is created, based on the values in the approval matrix.
    On the approval process, in the approval steps, set the Assigned Approver to the appropriate lookup field on the record (Approver 1, Approver 2, and Approver 3).

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos