Custom Button to Launch an Approval Process
Prompt
Determine the setup necessary to launch a Process Builder from an Approval Process.
Solution
- In a vanilla Trailhead org, create a “Submission” object with a few fields:
Approval Status
: Picklist field- Pending, Approved, Denied
Requested Amount
: Currency fieldAmount
: Currency field
- Create a new Quick Action called “Submit for Approval” on Submission that changes the Approval Status to
Pending
- Navigate to the Submission object, then go Cog Wheel > Edit Page
- “Update to Dynamic Actions” using link in right-hand panel, then “Migrate” existing actions
- Remove all other Action Buttons, then add the new “Quick Action” called “Submit for Approval”
- Create an Approval Process
-
- Entry Criteria: Submission: Approval Status - equals - Pending
-
- Next Approver: Determined by: Manager
-
- Add fields on approval page layout as appropriate. Select checkbox to “Display approval history information in addition to the fields listed above”
-
- Select checkbox to “Add the Submit for Approval button and Approval History related list to all Submission page layouts”
-
- Add an Approval Step
- All records, approved by submitter’s manager
- If Approved: Field Update: Update “Submission: Amount” field to “Requested_Amount__c”
- Final Approval/Denied Actions
- Field Update: Update “Submission: Approval Status” field to “Approved”
- Field Update: Update “Submission: Approval Status” field to “Denied”
- Field Update: Update “Requested Amount” field to Null
- Set up a Process Builder that fires when Approval Status is set to Pending
- To test, set up a user that reports to my user.
- Turn on System Admin’s ability to log in as other users via: Setup > Login Access Policies > Checkbox: System Admins can log in as any user
The prompt is taken from content on Salesforce's Trailhead website.