This chapter’s objectives are:
- 13.1- Describe when workflow are evaluated
- 13.2- Describe the capabilities of workflow rules and actions
- 13.3- Given a scenario, identify the appropriate workflow solution
- 13.4- Describe capabilities and use cases for the approval process
Automation in SF falls under 2 categories: Workflow Rules (Auto) and Approval (manual). This section describes these in details.
13.1- Describe when workflow are evaluated
13.2- Describe the capabilities of workflow rules and actions
Workflow Rules: are used to automatically take action when a record meets certain criteria. The administrator configures the workflow process which determines:
WR are evaluated based on the Evaluation Criteria you specified, and based if this is a time based WR or not.
Workflow creation steps: Go to Build | Create | Workflow and Approvals
- In screen 1, select Object: ex. Opportunity
- Give WR a name and Description
- Set evaluation criteria: ex. Created, and any time it’s edited to subsequently meet criteria
- Set rule criteria: ex. Criteria are met – Stage = Awarded
- Set action: ex. Send email to VP Sales congratulating him
- Set time trigger(s) if needed: ex. 7 days before close date
- Activate the Workflow Rule at the end
- Created: check rule criteria only when created
- Created, and every time it’s edited: check rule criteria when created and on each save regardless if evaluation criteria is met or not! (cannot be used in conjunction with time-based workflow actions)
- Created, and any time it’s edited to subsequently meet criteria: when record is created, and when record that doesn’t meet criteria is edited to meet criteria.
- Based on field value. Ex. Opportunity stage = Closed – Lost.
- Based on Formula.
Immediate Actions: fires immediately when Evaluation criteria + Rule criteria are both met. Actions are:
- Send email: select a template for the email alert, then select the recipients (user, role, opportunity team, group, account owner of opportunity …etc.) can specify 5 exact emails, and the from email address.
- Assign task: assign to user, role, opportunity team, opportunity or account owner…etc. Give subject, due date (can be relative to opportunity close date), status, priority, comment.
- Update field: can update the field in the Record itself, or in a cross-object field. You can select to Reevaluate WR after change. And you can select Save and New to update more than 1 field!
- Outbound message: Send message to external API Web Services system, for example ERP after Opportunity booking or HR system after expense approval: specify the URL of the system, the fields to send.
- Make sure to make it Active.
- You can add Actions later on to any WR
Time-Dependent Actions: you cannot add this type on an active rule. You should deactivate the WR first.
- Step 1: specify the time to wait after trigger fired or after any condition based on field.
- You can specify after how long to fire after Evaluation criteria + Rule criteria are both met.
- Step 2: define the Action – just like the above
- Activate the WR!
- Monitor in Setup | Monitor | Time based Workflows – make sure triggered
- IMP: what happens if system is waiting to perform an Action and the criteria no more good? The action is cancelled!
Example: update “Closed” field to Today when closing:
- Many Workflow Rules can be active at same time:
Each rule can contain 1 or more actions:
13.3- Given a scenario, identify the appropriate workflow solution
For example, you could create a workflow rule to notify the strategic accounts team public group when an opportunity is greater than $1,000,000 USD. Examples: https://help.salesforce.com/apex/HTViewHelpDoc?id=workflow_examples.htm&language=en_US
13.4- Describe capabilities and use cases for the approval process
Approvals: as we saw above, a workflow rule automatically takes action based on record criteria, whereas an approval process is manually initiated by the user. The administrator configures the approval process which determines:
- The criteria that must be met in order for a record to be eligible for manual submit for approval
- Who approves the record
- What actions take place as a result of approval or rejection? (same actions as the Workflow: send email, assign task, update field, send message to API)
They can be built around: Expense Reports, Time-off request, New hire procedure, Approving and renewing contracts, discounting opportunity , changing opportunity status: For example opportunity with amount more than 50K USD must be approved by your manager prior to stage=proposal or above (Identified, Qualified, Proposal…)
Key approval features:
- Multiple approvers can be assigned in the order you specify
- Once item submitted for approval, it can be approved, rejected or recalled. Via email, home tab, chatter
- Records can be locked to prevent changing while approval is pending
Approval creation steps:
- Go: Build | Customize | Workflow & App | App. Processes
- Select the Object from the Top list (Opportunity , Account…)
- You can choose wither the 2 jump wizard (assumes some configuration. Check Link), or the standard (all options-better)
- Step 1. Enter Name and Description. Ex. “Manager should approve before stage=Proposal and more than $50K”
Step 2. Specify Entry Criteria (optional): criteria that must be met in order for a record to be eligible for manual submit for approval. For example:
- Approved = False (approved is a custom checkbox field in the Opportunity object, that changes to true as a result of approval action. This way you cannot submit for approval when already approved).
- Or you can use a picklist field with 3 values: Approved, pending and rejected (maybe a better option) – these fields should be hidden or RO (better). You can also have Flags with field (green, yellow and red).
- Or you can have a checkbox that should be checked – it won’t be able to be checked unless other fields are filled (validation rules). Note: criteria can be field based or Formula based (complex).
- If Entry criteria not met, or no Approval configured and active, user who submits for Approval will get this error:
Step 3. Specify Approver Field and Record Editability Properties
- Select Field Used for Next Automated Approval: Manager of the requestor: manager of the user set in the User page. Note that you can specify new hierarchical relationship field. You can create your own “Custom User Fields”, this way you will have on the User page custom User fields, like “HR manager”. To do so, click on “Create a custom user hierarchical relationship field” in the first page of the Approval Processes page, and select field type=”Hierarchical Relationship”, specify the field name and Child name “HR_Manager”, and in the User details page you now have the “HR Name” field (User lookup). Also Note that if you do not select a field here, you will not be able to create any steps later that automatically assign a request to an approver.
- Record Editability Properties: Admin, or Admin and the approver can edit while in Approval process?
- Step 4. Select Notification Templates: Select the email template to be used to notify approvers that an approval request has been assigned to them (if blank, default will be used)
Step 5. Select Fields to Display on Approval Page Layout and enable or not “Display approval history information in addition to the fields selected above.” And finally checkbox “Allow approvers to access the approval page only from within the Salesforce application”
Step 6. Specify Initial Submitters: Using the options below, specify which users are allowed to submit the initial request for approval. For example, expense reports should normally be submitted for approval only by their owners (options are creator, owner, any user via search, role…). And, at the bottom, enable or not “Allow submitters to recall approval requests“.
Click on save: “You have just created an approval process. However, you cannot activate this process until you define at least one approval step”. Before that, let us see what we did (see below). Note that you can edit any step by choosing what to Edit in the edit button of the Approval Process page below (there are a total of 6 links corresponding to the 6 steps above). Also, you can create the steps in the section below in that page.
Now you can configure the Approval Process details:
- Initial Submission Actions: what will happen when user submits for Approval (here Lock). You can add new Actions at will – no need to add an email, as auto email will be sent to each approver once they need to approve. Example, field update for Approval status dropdown=Approval in Process.
- Approval Steps: define to whom an approval request is routed, and any actions that should be performed on approval or reject.
- Final Approval Actions: what will happen when Final approval reached
- Final Approval Actions: what will happen when Rejection reached
- Recall Actions: what will happen when recall is clicked (if available)
To create Approval Step, click “New Approval Step”
Step 1. New Approval Step: name “Approval Step 1
Step 2. Specify Step Criteria: Specify whether a record must meet certain criteria before entering this approval step. If these criteria are not met, the approval process can skip to the next step, if one exist. Here you can say if amount more than 50K enter step, otherwise Approve (MDS 50K).
Step 3. Select Assigned Approver: Specify the user(s) who should approve records that enter this step. Can be the manager that you defined during the Approval Creation step above, or any user/role. can have up to 25 individual users! Can also be Queue if Lead and Cases optionally, choose whether the approver’s delegate is also allowed to approve.
- Note that the Approver can be the Owner Manager, or a custom hierarchical relationship field on the user record. See the fields in the Red square that are in the User page. You can choose 1 of them.
What Would You Like To Do Now? You have just created an approval step. You can optionally specify workflow actions to occur upon approval/rejection of this step
- Approval Steps can be sequential or branches
- Finally, when all Steps are done, Approval Actions, Recall actions or Rejection Actions.
- Approval Process Examples: Discounting opportunities, Time-off Requests, Expense Reports
- Note: after the approval process is activated you cannot delete, add or modify the approval steps. You need to CLONE the approval process to add approval steps
- Note: for both Workflow Rules and Approval, Actions are the same
- Process Visualizer: displays the Flow chart of each Approval Process: Click on View Diagram to see the Process Visualizer: a Visio-Like view of the process – Interactive and can also have Printable View that include the Visio like diagram as well as the Documentation details
Another Approval Process Example:
This example is based on this YouTube Video:
- In this example, the Approval Status is a custom picklist field.
To create the Approval Process:
- Go to Build | Create | Workflow & Approvals | Approvals, select opportunity, then Standard Setup
- Step 1: enter name and Description
- Step 2: select the entry criteria. If criteria does no match, then you cannot submit for approval. Here it will be any applied discount can be submitted for approval.
step 3: choose the Approver Field
Note that you can create your own hierarchical relationship fields. IMP: also Use Approver field of opportunity owner: always use this regardless of who submits for approval (check this box) in this case the approver of the owner is the one as opposed as the user who submits the record for approval.
- Step 4: select the email template that the approver will get to approve or not. If yo
u leave it, then the standard one will be sent? Also add the Post template to be used in chatter (also optional).
- Step 5: Layout page – customize it to select which column see
Step 6: Specify Initial Submitters: who can hit the Submit for Approval? In this case: Opp Owner
And can this Submission be recalled?
- Save! You can now create the Approval Step!
- Now you go to the Approval Process detail page that has all the above info!
- You can add actions on Initial Submissions, Final Approval, Rejection and Recall and you can also create Approval Steps!
Create a new Initial Submission Action: change Approval status to pending (This is a custom picklist field) – this way once you click on Submit for Approval, the status of this custom picklist field is Pending (or you can make yellow flags).
Let’s crate a new Approval step:
- Step 1: Enter name and description (Step number 1).
Step 2: Specify step criteria: only to be approved by Discount Approver if more than 15%. Else, auto approve! (Else is only on the first step)
- Step 3: Select Approver: “Discount Approver” – this is the Record on the user page.
Now, this is the last step of the Approval Step:
- Step 1: Enter name and description (Step number 1).
Approval Step 1 is done:
Let’s add a new Approval Step
- Step 1: Enter name and description (Step number 2)
Step 2: Specify step criteria: only if more than 40%.
Step 3: Select Approver: the user “Allison Wheeler” and specify the Rejection behavior:
Step 2 is done:
- Now we have 2 Approval Steps:
- Add Final Approval actions: Notification email to Opp owner (Discount Approved email template), and change Approval Status = Approved
- Add Final Rejection actions: Notification email to Opportunity owner (Discount Not Approved email template), and change Approval Status = Not Approved, and reset discount to 0%.
- Activate it!!!
- Click on View Diagram to see the Process Visualizer: a Visio-Like view of the process – Interactive and can also have Printable View that include the Visio like diagram as well as the Documentation details.
- Test it by Logging-In as another user (from the Admin account – Users – Login As)
Custom Report Type for Approval History:
- Go to Build | Create | Report Types – New
- Primary Object: Process Instance. A process instance represents one instance of an approval process. A new process instance is created each time a record is submitted for approval.
- Select the box under process Instance, and select: Process Instance Node
- A process instance node represents an instance of an approval step. A new process instance node is created each time a record enters a step in an approval process. No process instance node is created when the record doesn’t meet the step criteria or if the approval process instance is otherwise completed without entering the step.
Select your desired A to B relationship. Either only includes an Approval Step, or also those that don’t have any Step.