Using approvals
Let’s test our new approval. But before this, let’s create a workflow rule on the Opportunity object that resets the Approval Status field if the amount field is updated, as shown in the following screenshot:
Workflow rule to reset the approval status on the opportunity record
Note that the rule criteria is ISCHANGED(Amount), which states that the rule fires any time the Amount field is updated.
We are now ready to test. Let’s proceed with the following steps:
- Using a lower hierarchy user (which should have a Manager defined), create a new opportunity by setting the following values:
• Name: Whatever you like
• Stage: Any
• Close Date: Any
• Amount: $15.000,00
• Approval Status: Pending (defaulted) - Now click on the Submit for Approval button (it should be next to the Clone button, depending on your layout configuration) and add a note on the modal (this should be used by the approver to take a decision). Nothing will appear to happen, but a green message will pop up stating that all went okay, and if you look at the Approval History related list, you can see two new items:
Approval history example
What has just happened?
As the opportunity amount was lower than $100,000, the approval process automatically approved the record. Approved actions were automatically executed, as we can see in the following screenshot:
Approval actions executed on the Opportunity record
The Approval Status automatically changed to Approved and the record is also unlocked. Try to edit any record: nothing will prevent you from updating the opportunity.
Let’s change the Amount field to a value greater than $100,000; we expect the Approval Status to be changed back to Pending by the workflow rule created earlier.
3. Now let’s submit it for approval again. The record Approval Status will change to Submitted. Now click the Submit for Approval button again and try to edit the record:
Record lock error
Now the record has been submitted for approval, but as the amount is greater than $100,000; the record needs explicit approval by the user’s Manager (which in this example is Mary Smith) and has been locked:
Pending approval on the approval history
We have configured the approval to notify the approver with a standard email template and a Chatter post. This is what she gets via email:
Email notification for approval request
This is the standard Chatter post:
Chatter notification for approval
Click on the notification to jump to the approval page:
Approval page
By approving or rejecting the request, the approver can add a comment to justify their choice.
4. Approve the request. The Approval History related list will now show the last entry with the approved status:
Approval history with the last step approved
What happens if we change the Amount field to be greater than $1,000,000?
The approval must be approved by Mary Smith (the Sales SVP) and then by Enrico Murru (the CEO), in subsequent steps: this means that if Mary rejects the record, Enrico won’t have any actions to perform.
This is the approval history when both requests have been approved by the manager and the CEO:
Approval history with two steps
The following configurations and components are available on the platform to speed up approval on the user’s side:
- An Items to Approve Lightning component only for the home page in Lightning Experience (use the Lightning App Builder to set up home pages)
- An Approval Requests navigation item only for Lightning apps in Lightning Experience (go to Setup | App Manager to edit an app)
- Add the Approval Items to the Salesforce app navigation menu for the Salesforce Mobile App
- Add the Items to Approve related list to the required home page layouts in Salesforce Classic
Approvals can be handled by approvers simply by replying to the notification email response, a feature that can be enabled from Setup | Process Automation | Process Automation Settings by checking the Enable email approval response checkbox.
The approver can then respond to the notification email with an APPROVE or REJECT on the first line and a comment on the second line, without even accessing Salesforce, which will lead to the same result on the Approval History related list.
For more information about this cool feature, refer to Salesforce Help at https://help.salesforce.com/articleView?id=approvals_email_parent.htm&type=5.