Process Automation in Salesforce
What is Process Automation in Salesforce
Why do we need to automate the process and which process we are talking about here.
For example automating process means - when a user get's registered then there should be a email which should be sent to him and they should register on the link which is mentioned in email when they register on that link and submit it they should get a confirmation mail and they should get id this is a one of example complete process.
In Salesforce we can achieve process automation in 2 ways :
Declarative Approach (Point and click)
Programmatic Approach (Coding)
Declarative Approach:
i) Workflows
ii) Process builder
iii) Lightning flows
iv) Approval process
i). Workflows :
Workflow in salesforce is powerful automation tool. They allow you to create automated actions that are triggered by specific events or conditions that is criteria, such as record creation, field updates, or changes in record status.
Workflow can contain multiple action that is email alert, field update etc.
Workflow has 2 components :
Criteria
Action
Criteria:
It consists of the condition which if found true then the actions should take place.
The criteria is evaluated when the record is saved as like validation rules.
Action:
- It consists of the actions that should be performed when the criteria for workflow rule are met.
There are two types of workflow actions that we can execute with help of workflow rules:
Immediate action - Means you created a record and you want action to be executed right now.
Time triggered action - You save the record right now and then action will happen later.
Time trigger actions cannot be added to active salesforce workflows. To add a time trigger action first deactivate the workflow rule then add an action.
Another time trigger cannot be added if there is already a time trigger action scheduled for that object and present in a time-based workflow queue. You need to delete all scheduled time trigger action from time-based workflow queue.
The action a workflow rule takes can also trigger the execution of other workflow rules.
Time-Based Workflow Queue : All the scheduled time-trigger action gets registered in time-based workflow queue and whenever time hits it automatically executes action
To check the scheduled time-trigger action go to setup->Time-Based Workflow and you can see there.
You can delete the action which you don’t want.
Default Workflow user : Default Workflow users are the users that will be visible when the user that triggered the rule is not active. Administrators can also set default workflow users.
Evaluation Criteria :
- It means when will the criteria of workflow will evaluate and when it will not be evaluated.
We have 3 types of evaluation criteria.
Created : If you want the workflow criteria to be evaluated if the record is getting created. If the record is getting edited & save and you don’t want to evaluate the criteria of workflow to be evaluated then select evaluation criteria as created.
Created & every-time its edited : This means that, evaluate the criteria of workflow if the record is created and also if that record is edited. When workflow criteria is evaluated then action is performed
Created & anytime its edited to subsequently meet the criteria :
Runs the rule if criteria is met :
A) Always when a record is created and meets the criteria
B) Only when a record not meeting the criteria is updated and now it meets the criteria.
Let’s create workflow :
Whenever you create workflow rule you have to select on which object you are going to create workflow rule.
You can create a workflow rule for a single object at a time.
Step 1 : Go to setup->workflow rules->new rule
Step 2 : Select Evaluation criteria
Step 3 : Set the rule criteria.
Step 3.1 : Criteria are met.
Step 3.2 : Formula evaluates to true.
Step 4 : Lets create Email Alert action as of now so select New Email Alert.
Step 5 : New Email Alert Before this go to setup -> classic email template -> new template -> as of now select text -> then fill info and save
Step 6 : Now select the email template
Step 7 : Select Recipient Type as Email Field and then save
Step 8 : Click on done and you need to click on activate
NOTE : If you want to execute the workflow on every record then only write true in formula evaluates to true
Now understand what are types of action in workflow:
Email Alert :
- Means sending an email automatically which we saw above
Field Update :
Field updates allow automatic change of a field value on the record that initially triggered the workflow rule.
If “Re-evaluate Workflow Rules after Field Change” is enabled for a field update action then Salesforce re-evaluates all workflow rules on the object if the field update results in a change to the value of the field.
Only workflow rules that didn’t fire before will be retriggered.
Cross Object field updates are also available for changing the values of fields on a related master record. But it is not available when re-evaluation is checked.
Steps to add field update action:
Requirement : Whenever student record is created we need to change its owner to queue which we created earlier this is one of the best example while studying queues we were manually changing the owner of the record to owner as queue because we were not aware of automation. Now you can do this.
Step 1 : If you want to add in existing workflow go under immediate workflow action and click "add workflow action"
Step 2 : Select New field update.
Step 3 : fill the info and under "Field to Update" select the owner field (as we want to update owner field automatically so select owner field here)
Step 4 : under Specify New Field Value select "Owner" as Queue and the value of queue which we created or the queue which you want.
As we have created this on existing workflow which is set for students, Now if you create student then its owner will be set to Queue value which you selected and also if the criteria which you mentioned in email action if those are met then email will also be sent to the user.
Tasks :
It simply assigns a task to a single user, owner, or a role. We can also make sure that a notification email is sent to the assignee when a task is automatically assigned.
Tasks should be assigned to roles if they have only one user assigned to that role. If there are more than one user assigned to that role then the task automatically gets assigned to the owner of the workflow rule Users who triggered the workflow rule.
If you view a record on right side there will be activity section. The activity section can be enabled on the object If it is not enabled you may not see it you need to activate on the object.
The task object is related with the activity make sure you have activity activated in you page layout
Outbound Message :
- An outbound message sends particular information to a designated endpoint such as an external service. These types of messages can be listened to using a soap API.
ii). Process Builder :
More actions are provided in process builder.
In workflow the order is not guaranteed but in process builder order is guaranteed.
Workflow and Process builder is not used by industry now (They might get retire). Lightning flows are more advanced version.
iii). Lightning Flow :
- You can find lightning flow related information here.
iv) Approver Process :
- An Approval Process in Salesforce is an automated system for managing and controlling record approvals.
Key Components of an Approval Process:
Entry Criteria: Defines which records should enter the approval process based on specific criteria (e.g., approval required if an opportunity is worth more than $10,000).
Approval Steps: Defines the sequence of steps that a record must go through, each with one or more approvers.
Initial Submission Actions: Actions that are triggered as soon as a record is submitted for approval (e.g., lock the record from further editing).
Approval Actions: Actions that occur when a record is approved at each step, like sending emails, updating fields, or creating tasks.
Rejection Actions: Actions that occur when a record is rejected, like notifying the submitter or updating record fields.
Final Approval and Final Rejection Actions: Actions that occur when the record is fully approved or rejected, marking the end of the process.
Recall Actions: Allows the submitter to recall or withdraw the record from the approval process.
How an Approval Process Works:
Submit for Approval: A user submits a record for approval. Based on the entry criteria, the record enters the approval process if it meets the specified requirements.
Routing and Approval Steps: The record is routed through designated approvers as defined in the steps of the approval process. Approvers can approve or reject the record.
Actions and Notifications: Salesforce triggers actions (such as notifications, field updates, and record locks) based on the status of the record at each stage.
Final Approval or Rejection: Once the record completes the final step in the approval process, it is either fully approved or rejected, triggering any final actions.
Let’s understand how to create Approval Process:
For example if scholarship amount < 2000 it should be automatically approved
< 5000 : faculty should approve it
< 10,000 Manager should approve it
10,000 CEO should approve it
To create approver process go to setup → Approver process.
Step 1 : under "Approval Processes for" Select the Object
Step 2 : under "Create new approval Process" there are 2 options
Use jump start wizard : This automatically sets some of the properties of it
Use Standard Setup Wizard : If we want to set each and every property by ourself we can go with this
After this specify the entry criteria. That is field, operator, value
Step 3 : Specify Approver field and Record Editability Property
- We need to Select Field for automated approval Routing 2.We need to select "Record Editability Property" NOTE : Whenever a record gets into approval Process it gets lockedd (i.e we cannot edit recird)
Step 4 : In this select Email Notification template. That is whenever a record is assigned to a particular approver, an email should be sent to him automatically
Step 5 : Select fields to display on Approval Page Layout - Here you need to specify which fields will be visible to the approver only those fields will be displayed to the Approver while approvring or rejecting.
Step 6 : "Specify the initial Submitter" - Here you need to specify the user or roles who will be the submitter for approval request due to this "Submit for Approval" button will be available for selected user and roles if you do not mention user or role then you need to add "Submit for Approval" button from page layout.
You Approval process is created.
Now open approval process which you created there are many actions lets understand them.
Initial Submission Action : Initial Submission actions are the actions which gets executed whenever a new record get's submitted to this approval Process. For example : A record got submitted for scholarship approval now what actions you want to take at right moment when it got submitted to approval process, you will define those actions into initial submission actions
Final Approval Action : Here you can edit the locked record (non-editable) and you can make editable
- Final Reject Action : Once the record is finally rejected what action you want to execute you can specify here
- Recall Action : Whenever we withdraw/recall the request then what action should be executed we can mention in Recall Action
Approval Steps :
In approval steps we create different steps of approval
Step 1 : Click on New Step and enter step name
Step 2 : Enter the criteria which will allow the record to get into this step. Example : Field = Scholarship, Operator = Greater than or Equals, value = 2000 You will also need to select Approve or Reject in Else column which states that what to do if criteria does not meet.
Step 3 : Now select who is going to approve under "Select Assigned Approver" then save this first step.
NOTE : While creating 2nd approval step or further approval steps, In Step 3 where you are supposed to select approver there is "Reject Behavior" also under that there are two option you need to select one of those
Final Reject
Perform Only Rejection actions for this step and send the approval back to the most recent approver. NOTE : In Approval Step 1 in that at Step 2 we has else column but from Approval Step 2 we will not have that
Lets understand Approval Process with Scholarship example we took :
First thing is submit for approval.
Then Approval Process criteria needs to be evaluated (In our case we have set scholarship amount > 0) so it will check, and if the criteria is met then initial submission action gets executed and if it does not met record does not get submitted further
Lets say it meet's the criteria and scholarship fees is not null then it will execute the initial submission action.
After that it will go in approval step 1, there is a criteria over there also which is > 2000. If the criteria does not met then it depends on else part if you have selected rejected then it will go and execute final rejection action, if approve is selected then it will execute final approve action
Lets say in Approval Step 1 Criteria is met then the request gets routed to approver and that approver can do two things either approve or reject the request if he rejects the request then rejection action of step 1 gets executed then final Reject Action gets executed. if he approves the request Approval Action of step 1 gets executed and request is routed to the next Approval Step, if present otherwise final Approval Actions. lets say it is routed to next step that is Approval step 2 here criteria is amount > 5000 but our amount is 4000 so our request was approve from Approval step 1 and it has came to Approval Step 2 and here the criteria is not meeting so it will be finally Approved. Final Approve Action will be executed
Lets say scholarship amount is 8000 then criteria in Approval Step 2 is met so it will be routed to next Approval Step that is Approval Step 3.
There can be multiple active approval processes on a single object in Salesforce. However, only one active approval process can be set to auto-start based on entry criteria for any given record at a time. Here’s how it works:
Multiple Active Approval Processes: You can have multiple approval processes active on an object simultaneously. This allows different types of records or different scenarios to have unique approval processes tailored to them.
One Auto-Triggered Process: If an approval process is set to start automatically based on entry criteria, only one of these auto-start processes will be triggered for any record that meets the criteria.
Manual Submission: Users can still submit records manually to any of the active approval processes on the object, even if another approval process is set to auto-start.
Example Scenario
Suppose you have an "Expense Report" object with two active approval processes:
High-Value Expense Approval: Auto-starts if the expense is over $10,000.
Standard Expense Approval: Can be started manually for expenses under $10,000.


