Save approver automatically in Approval Processes with Process Builder and Flows

In previous post,I shared how to 《Create Roll-Up Summary field to count Contacts on Account with Process Builder and Flows》.
In this post I will share about how to save approver(current user) to the target object automatically in Approval Processes, with Process Builder and Flows.

Actually,this is another interesting usages of Process and Visual Flows.

Here is the list of setting we need to create,include Approval Processes:
Custom Fields (Contract Object)
ContractApproval (Approval Processes)
ContractApproverUpdate (Flows)
ApproverUpdateProcess (Process Builder)

New custom fields

Create a custom field(Formula(Text)) on Contract named “CurrentUserId” for getting current running user. 1. Contract  New Custom Field   CurrentUserId 2. Contract  New Custom Field   CurrentUserId Create another custom field(Lookup(User)) named “Approver” for storing approver value. 3. Contract  New Relationship   Approver


Create an Approval Process named “ContractApproval” on Contract like the following image. 4. Approval Processes  Contract  ContractApproval And the Field Updates “StatusUnapproved”. 4. Field Update  StatusUnapproved Field Updates “StatusApproved”. 5. Field Update  StatusApproved Don’t foget to check the “Re-evaluate Workflow Rules after Field Change” option.Trust me, this is really important.
※The Process “ApproverUpdateProcess” we need to create next will not be evaluated if it’s without that option.


Create a Visual Workflow add a Fast Loopup element named “LookupTarget” to flow area. 4. Flow Designer LoopUp Create a Variable named “varTargetId” and a SObject Variable named “targetContract”. 5. Flow Designer  varTargetId 6. Flow Designer  targetContract Add a Record Update element “ApproverUpdate” at the end. 7. Flow Designer  ApproverUpdate Now,set the Fast Loopup element to be a Start Element and link two elements. 8. Flow Designer  Flow Save flow as “ContractApproverUpdate” and activate it. 9. Flow Designer  ContractApproverUpdate 10. Flow  ContractApproverUpdate


Create a process named “ApproverUpdateProcess” from Create > Workflow & Approvals > Process Builder. 11. Process Builder ContractApproverUpdateProcess Add Contract object and save it. 12. Process Builder ContractApproverUpdateProcess Add a criteria with the below Formula and save it. 13. Process Builder Add a action for the criteria when it is true,and select the flow “ContractApproverUpdate” we created before. 14. Process Builder Now activate the process. 15. Process Builder

Operation check

Create a contract and submit for Approval with user “Staff” 16. Contract  00000105 Approval contract with user “Manager” 17. Contract  00000105 18. Contract  00000109 Not bad, isn’t it?
Enjoy it!