Getting Started with Process Builder – Part 31 (Dynamic Approval Routing in Salesforce)

Posted on Updated on

Dynamic approval processIn Salesforce user can use Approval process to get approval from managers or higher authority. Approval processes route a record to one or more approvers, specifying the steps necessary for a record to be approved, and who must approve it at each step. In a normal approval process, i.e. Static approval process, the approvers at each step are explicitly specified in each step approval process or you can have the submitter choose the approver manually, as shown in the following screenshot

Static approval process
Static approval process

Whereas dynamic approval routing allows us to specify the approvers for each record using User lookup fields on the record requiring approval. These fields can be populated using the Process Builder or Apex, using data from a special custom object/setting that contains all the information needed to route the record. Dynamic approval routing provides the flexibility to route the approval request to different people based on Account Type or some other criteria related to the record. Let’s start with a business use case

Business Use case :- Steven Greene is working as System administrator in Universal Container. He has received a requirement from the management, to route opportunity approval requests to designated approvers, based on the opportunity’s Lead Source and the opportunity’s account type.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the above business requirement. The steps to create dynamic approval routing are mentioned below

  • Create a custom lookup (with user object) field on the object being approved
  • Create a custom settings/object that will be used as an approval matrix
  • Populate the approval matrix, i.e. create a few records in Custom settings/object
  • Use Flow and Process Builder to populate the lookup field on the record, from the approval matrix
  • Create or update an approval process to utilize the new lookup fields

Follow the below instructions to solve the above business requirement

1. Create a custom lookup field on the Opportunity object, called as Opportunity Approver as shown in the following screenshot

Custom field
Custom field

2. The next step is to create a custom object (Approver Matrix) and few custom fields  to store all the fields used in routing, as shown in the following screenshot

Custom Object
Custom Object

3. The next step is to create the approval matrix records. For example Lead Source = Web and Type = Existing Customer – Upgrade, one might route the records to Helina Jolly as Opportunity Approver. It will loo like the following screenshot

Approver Matrix
Approver Matrix

4. Now we will use Flow and Process Builder to populate the lookup field Opportunity Approver on the opportunity record, from the approval matrix.

Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows and then click on the New Flow, it will open the Flow canvas for you. Now create few Text variables VarT_LeadSource,  VarT_Type,  VarT_OpportuntiyApprover and VarT_OppId to store Lead source, Opportuntiy Type, opportunity Approver and Oportunity Id respectively.

5. The next step is to get the Opportunity approver, for this we will use record lookup element. To do this drag-and-drop Record Lookup element (Enter the name To get opportunity approver) onto the canvas and map the fields according to below details

  • Select Object Approver_Matrix__c
  • For criteria select Type__C= {!VarT_Type} and Lead_Source__C{!VarT_LeadSource}.
  • Save the Opportunity approver in a Text variable as shown in the following screenshot
Record Lookup - To get Opportunity Approver
Record Lookup – To get Opportunity Approver

6. Now we will use the Decision element to check the Text Variable {!VarT_OpportuntiyApprover} size. If the Text Variable is not equal to null then we will go ahead and update Approver on opportunity record otherwise we will update it with a default approver. You can take help from the following  screenshot to create a  Decision Element

Decision Element - Check Text Variable Size
Decision Element – Check Text Variable Size

 

7. The next step is to update an Opportunity record. For this we will use Record Update element. Drag-and-drop Record Update element (Enter the name Update Opportuntiy Approver) onto the canvas and map the fields according to the following screenshot

Record Update - To update opportunity approver
Record Update – To update opportunity approver

8. In case if there are no approver exist in Approver Matrix for current opportunity based on Type and Lead Source then we will update, Opportunity Approver with a default user Id. For this we will use Record Update element. Drag-and-drop Record Update element (Enter the name Update Default approver ) onto the canvas and map the fields according to the following screenshot

Record Update - To update default approver
Record Update – To update default approver

Finally your Flow will look like the following screenshot

Dynamic Approval Routing

8. Save your flow with name Dynamic Approval Routing and close the canvas. Don’t forget to Activate the Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on the Opportunity object to launch a Flow. To create a Process Builder on the Opportunity object follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder  and click on the New button, Enter Name, API Name and then click on the Save button

Define Process Properties
Define Process Properties

2. The next step is to add entry criteria. For this click on Add Object, select Opportunity object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button

Record Evaluation Criteria
Evaluation Criteria

3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Opportunity].LeadSource Is Null False or [Opportunity].Type Is Null False ) and click on the Save button as shown in the following screenshot

Process Criteria
Process Criteria

4. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Flows), and then fill out the fields to define the action, as shown in the following screenshot

Add action – Flows
Add action – Flows

5. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot

Dynamic Approval Routing in Salesforce

 Don’t forget to active the Process by clicking on the Activate button.

Modify the existing approval process

Final step is to modify the existing approval process. I assume that you have created an active approval process on Opportunity object, as shown in the following screenshot

Approval process on Opportunity
Approval process on Opportunity

Now modify the approver step, and select related user Opportunity approver, as shown in the following screenshot

Select Assigned Approver
Select Assigned Approver

It’s time to test this feature

1) Navigate to the Opportunity tab, identify the Opportunity and click on Opportunity Name.
2) Update the Lead Source and Type, Process Builder automatically populate the Opportunity approver field, as shown in the following screenshot

Opportunity Record
Opportunity Record

3) Finally submit an Opportunity record for approval.

Approval Request
Approval Request

Note :-  I will suggest you to implement this first on your developer org, test it and then move it to production. Don’t try to implement this in Spring’15 org, otherwise you will get an error.

 

Getting Started with Process Builder – Part 30 (Auto-generate renewal Opportunity with Line Items)

Posted on Updated on

Opportunity

Opportunities are the sales and pending deals that you want to track. By adding opportunities, you’re building your pipeline, which contributes to your sales forecast. Products are a catalog of items that your company can sell. An Opportunity Product is the specific item or service that is purchased and delivered to the client as it relates to that specific opportunity. The Opportunity line item, also known as Opportunity Product in the user interface. Many Organization are using opportunity for renewal business of assets, and software. There are no out of box feature that allows you to auto generation of renewal opportunities based on the close date of a current opportunity or once an opportunity is successfully closed won. Let’s start with a business use case

Business Use case :- Steven Greene is working as System administrator in Universal Container. He has received a requirement from the management, to auto create/generate a new Opportunity with opportunity line items based on the close date of a existing opportunity.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the above business requirement. Before proceeding ahead, you have to understand OpportunityLineItem objects in SalesforceOpportunityLineItem represents an opportunity line item, which is a member of the list of Product2 products associated with an Opportunity. Follow the below instructions to solve the above business requirement

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open the Flow canvas for you. Now create few Text variables VarT_AccountId, VarT_OldOpportunityId, VarT_NewOpportunityId, VarT_PricebookId and VarT_OldOpportunityName to store the Account Id, old Opportunity Id, new Opportunity Id, existing Opportunity Price Book Id and old Opportunity Name respectively.
3. The next step is to get all the Opportunity Line Items from the existing opportunity. To do this drag-and-drop Fast Lookup element (Enter the name To get all Line Items from existing opportunity) onto the canvas and map the fields according to below details

  • Select Object OpportunityLineItem
  • For criteria select OpportunityId = {!VarT_OldOpportunityId}, as shown in the following screenshot
Fast Lookup - To get all line items
Fast Lookup – Get all line items

4. The next step is to create a new Opportunity, for this we will use Record Create element. Drag-and-drop Record Create element (Enter the name Create new opportunity) onto the canvas and map the fields according to the following screenshot

Record Create - Create new opportunity
Record Create – Create new opportunity

5. Now we will use the Decision element to check the SObject Collection Variable {!SOC_OLI} size. If the SObject Collection Variable is not equal to null then we will go ahead else do nothing. You can take help from the following  screenshot to create a  Decision Element

Decision Element - Check Collection Variable Size
Decision Element – Check Collection Variable Size

6. The next step is to extract the opportunity line items from SObject Collection Variable {!SOC_OLI} one by one. For this we will use Loop Element. To do this Drag and drop a Loop Element ( Give the name Extract 1 by 1) onto the canvas and loop through SObject Collection Variable {!SOC_OLI} and save current value in a SObject Variable {!Sov_OLI}  as shown in the following screenshot

Loop Element
Loop Element

7. Now Drag and drop an Assignment Element ( Give the name Assign data into new a SObject Variable) onto the canvas and map the fields according to the following screenshot

Assignment Element - Assign data
Assignment Element – Assign data

8. The next steps is to add all SObject Variables into a SObject Collection Variable, So at the end we will create records in OpportunityLineItem. Drag and Drop Assignment Element (Give the name All in one) on the window and assign value from SObject Variable {!NEWOLI} to SObject Collection Variable {!SOCNewOLI}, as shown in the following screenshot

Add records in a list
Add records in a list

9. The final task is to create records in the OpportunityLineItem object. For this we will use the Fast Create Element. Drag and drop a Fast Create ( Give the name Create New OLI) onto the canvas and map the field according to the following screenshot

Fast Create - Create records in bulk
Fast Create – Create records in bulk

Finally your Flow will look like the following screenshot

5. Save your flow with name Auto-generate renewal Opportunity WIth OLI and close the canvas. Don’t forget to Activate the Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on the Opportunity object to launch a Flow. To create a Process Builder on the Opportunity object follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder  and click on the New button, Enter Name, API Name and then click on the Save button

Define Process Properties
Define Process Properties

2. The next step is to add entry criteria. For this click on Add Object, select Opportunity object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button

Record Evaluation Criteria
Evaluation Criteria

3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Opportunity].CloseDate Is Null False ), also select the check-box Do you want to execute the actions only when specified changes are made to the record?  and click on the Save button as shown in the following screenshot

Process Criteria
Process Criteria

4. The next step is to set the time for schedule action. For this click on Set Schedule available under Scheduled actions. Set time for scheduled actions as shown in the following screenshot

Define time based Process Builder
Define time based Process Builder

5. Now we have to add a Time-based action into the Process to launch a Flow. Click on Add Action (Under Scheduled actions), Select the type of action to create (In our case Flows) and then fill out the fields to define the action as shown in the following screenshot

Add action – Flows
Add action – Flows

6. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot

Auto-generate renewal Opportunity with Line Items

Don’t forget to active the Process by clicking on the Activate button.

It’s time to test this feature

1. Now create an Opportunity with few line items via the UI

Create new Opportunity with Line Items
Create new Opportunity with Line Items

2. Once the Opportunity gets created, the system will schedule a time based action to create a renewal Opportunity with Line Items. Below are the Proof of concepts

Proof of concept
Proof of concept

Note :-  I will suggest you to implement this first on your developer org, test it and then move it to production. Don’t try to implement this in Spring’15 org, otherwise you will get an error.

Getting Started with Process Builder – Part 29 (Auto Remove Followers from Questions with best replies)

Posted on Updated on

Remove Folowers

Chatter Answers is a self-service and support community where users can post questions, receive answers and comments from other users or your support agents. Chatter Answers bring together Cases, Questions, Answers and Knowledge article in a unified experience. A few months back, I had written an article Auto follow Question after reply, to discuss a way through which users can auto follow questions after reply. In this article I’m going to discuss a way through which system will auto remove the followers from Questions with best replies. Let’s start with a business use case

Business Use case :- Steven Greene is working as System administrator in Universal Container. He has received a new requirement to auto remove the followers from Questions with best replies. Actually they want to develop an automated process, it will responsible to auto remove the followers from Questions with best replies.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the above business requirement. Before proceeding ahead, you have to understand QuestionSubscription objects in SalesforceQuestionSubscription represents a subscription for a user following a Question. Follow the below instructions to solve the above business requirement

1. click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open the Flow canvas for you. Now create a Text variable VarT_QuestionId to store the question Id (we will pass the question Id through Process Builder), as shown in the following screenshot

Text Variable
Text Variable

3. The next step is to remove the followers from Questions with best replies. To do this drag-and-drop Record Delete element (Enter the name Remove Followers from Questions) onto the canvas and map the fields according to below details

  • Select Object QuestionSubscription
  • For criteria select QuestionId = {!VarT_QuestionID}, as shown in the below screenshot
Remove Followers from Questions
Remove Followers from Questions

4. Finally your Flow will look like the following screenshot

Remove Followers from Questions Flow

5. Save your flow with name Remove Followers from Questions Flow and close the canvas. Don’t forget to Activate the Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on the Question object to launch a Flow. To create a Process Builder on the Question  object follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder  and click on the New button, Enter Name, API Name and then click on the Save button

Define Process Properties
Define Process Properties

2. The next step is to add entry criteria. For this click on Add Object, select Question object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button

Evaluation Criteria
Evaluation Criteria

3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Question].BestReplyId Is null False), also select the check-box Do you want to execute the actions only when specified changes are made to the record?  and click on the Save button as shown in the following screenshot

Process Criteria
Process Criteria

4. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Flows), and then fill out the fields to define the action, as shown in the following screenshot

Add action – Flows
Add action – Flows

5. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot

Remove Followers from Questions PB

 Don’t forget to active the Process by clicking on the Activate button.

It’s time to test this feature

1) Navigate to the Q&A tab, identify the Question and click on its title.

Chatter Q&A
Chatter Q&A

Currently follower count is 2.

2) The next step is to choose one of the replies as the best answer.  Decide which reply is the best answer, and click Choose as Best Answer. As soon as you’re done refresh the page and check the follower count.

Final Outcome
Final Outcome

 

Getting Started with Process Builder – Part 28 (Auto Freeze Users Account)

Posted on

Freeze

There are few situations where the user account requires more work before deactivating it. To prevent users from logging in to the organization while you perform the steps to deactivate them, you can freeze user accounts. To freeze a user account, you have to navigate to the user record and then click on Freeze button. In this article I’m going to discuss a way through which you can automate this process. Let’s start with a business use case

Business Use case :- Steven Greene is working as System administrator in Universal Container. He received a new requirement to automate user freeze process. They want to allow their system administrators or delegated administrators to enter a user’s account freeze date and system will auto freeze the user account on that day.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the above business requirement. Before proceeding ahead, you have to understand UserLogin objects in Salesforce. Follow the below instructions to solve the above business requirement

1. First of all create a custom field Freeze Date (Data Type :- Date) on User object, as shown in the following screenshot

Custom field - Freeze Date
Custom field – Freeze Date

2. click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
3. Click on New Flow, it will open the Flow canvas for you. Now create a Text variable VarT_UserId to store the user’s Id (we will pass the user Id through Process Builder), as shown in the following screenshot

Text Variable
Text Variable

4. The next step is to update the field, IsFrozen on the UserLogin object to freeze the user’s account. To do this drag-and-drop Record Update element (Enter the name Update User Login Details) onto the canvas and map the fields according to below details

  • Select Object User
  • For criteria select UserId = {!VarT_UserId}
  • For update record fields select IsForzen= {!$GlobalConstant.True}, as shown in the below screenshot
Update User Login Details
Update User Login Details

5. Finally your Flow will look like the following screenshot

Freeze Users Account Flow

6. Save your flow with name Freeze users account Flow and close the canvas. Don’t forget to Activate the Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on the User object to launch a Flow. To create a Process Builder on the User object follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder  and click on the New button, Enter Name, API Name and then click on the Save button

Define Process Properties
Define Process Properties

2. The next step is to add entry criteria. For this click on Add Object, select User object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button

Evaluation Criteria
Evaluation Criteria

3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [User].Freeze_Date__c Is null False), also select the check-box Do you want to execute the actions only when specified changes are made to the record?  and click on the Save button as shown in the following screenshot

Process Criteria
Process Criteria

4. The next step is to set the time for schedule action. For this click on Set Schedule available under Scheduled actions. Set time for scheduled actions as shown in the following screenshot

Define time based Process Builder
Define time based Process Builder

5. Now we have to add a Time-based action into the Process to launch a Flow. Click on Add Action (Under Scheduled actions), Select the type of action to create (In our case Flows) and then fill out the fields to define the action as shown in the following screenshot

Add action – Flows
Add action – Flows

5. Add one more action to clear/empty Freeze_Date__c field. Click on Add Action (Under Scheduled actions), Select the type of action to create (In our case Record Update) and then fill out the fields to define the action as shown in the following screenshot

Add action – Record Update
Add action – Record Update

6. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot

Auto freeze users account PB

Don’t forget to active the Process by clicking on the Activate button.

Getting Started with Process Builder – Part 27 (Email notification for Draft Emails in Case Feed)

Posted on Updated on

Notification

Draft emails allow support agents who use Case Feed, write and save messages without having to send them immediately. It also allows us to implement approval processes so that messages can be reviewed by supervisors or senior agents before they’re sent to customers. Drafts are only supported if your administrator has enabled them, but there is no such option to send reminder notifications for Draft emails. Let’s start with a business use case

Business Use case :- Warren Mason is working as System administrator in Universal Container. Support agents from his organization are using email draft feature and want some enhancements. Many times they compose a new email on Case Feed and save it as a Draft. Later on they forget to send it, so they want a reminder notification (email) for Draft emails after 2hrs of its creation.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Flow and Process Builder to solve the above business requirement. You can also use Apex Triggers to solve the above business use case. Before proceeding ahead, you have to understand EmailMessage objects in Salesforce. Follow the below instructions to create a Flow to solve the above business requirement

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open the Flow canvas for you. Now create few Text variables in the Flow VarT_CaseID,   VarT_OwnerName and VarT_OwnerEmail to store the data.
3. Now we’ll create an email template using the Text Template. Navigate to the Resources tab and add one Text Template to create an e-mail template. Design it as per the business requirements. Please refer the following screenshot for more information

Email Template
Email Template

4. The next step is to use the Send Email static action to send out an e-mail to the owner. Navigate to the Palette tab and drag-and-drop the Send Email static actions onto the canvas. Please refer the following screenshot for more details

Send email - Static Action
Send email – Static Action

5. Finally your Flow will look like the following screenshot

Email notification for Draft email6. Save your flow with name Email notification for Draft Email and close the canvas. Don’t forget to Activate the Flow.

 Launch a Flow from Process Builder

Our next task is to create a Process Builder on the Email Message object to launch a Flow. To create a Process on the Email Message object, follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder  and click on the New button, Enter Name, API Name and then click on the Save button

Define Process Properties
Define Process Properties

2. The next step is to add entry criteria. For this click on Add Object, select EmailMessage object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button

Evaluation Criteria
Evaluation Criteria

3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [EmailMessage].Status Equals Draft), also select the check-box Do you want to execute the actions only when specified changes are made to the record?  and click on the Save button, as shown in the following screenshot

Process Criteria
Process Criteria

4. The next task is to set the time for schedule action. For this click on Set Schedule available under Scheduled actions. Set time for scheduled actions as shown in the following screenshot

Define time based Process Builder
Define time based Process Builder

5. Now we have to add a Time-based action into the Process to launch a Flow. Click on Add Action (Under Scheduled actions), Select the type of action to create (In our case Flows) , and then fill out the fields to define the action, as shown in the following screenshot

Add action – Flows
Add action – Flows
  • VarT_CaseID = [EmailMessage].ParentId
  • VarT_OwnerEmail =[EmailMessage].CreatedBy.Email
  • VarT_OwnerName = [EmailMessage].CraetedBy.FirstName

5. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot

Email notification for Draft Email
Email notification for Draft Email

Don’t forget to active the Process by clicking on the Activate button.

It’s time to test this App

1. Now compose an email (By navigating case detail page) and save it as draft as shown in the following screenshot

Draft email
Draft email

Sample email

Sample email
Sample email

 

Getting Started with Process Builder – Part 26 (Email notification for Completed Tasks)

Posted on Updated on

 Task completed

A workflow rule or Process Builder will automatically take action when a record meets specified criteria. It has a great capability to send out email notifications to a lot of different objects. This will allow you to notify a person or groups of people via email, when ever it meets the evaluation and rule criteria. Unfortunately, similar functionality does not exist for Tasks and Events objects. In this article I am going to discuss, how you can use Flow and Process Builder to overcome this limitation. Let’s start with a business use case

Business Use case :- Warren Mason is working as System administrator in Universal Container. He received a new requirement to send out an email notification for completed Tasks to assignor.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Flow to solve the above business requirement. You can also use Apex Triggers to solve the above business use case. Follow the below instructions to create a Flow to solve the above business requirement

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
2. Click on New Flow, it will open Flow canvas for you. Now create the few Text variables in the Flow VarT_AssigneeID,  VarT_AssignorID, VarT_AsignorIDEmailAddress, VarT_AssignorFirstName, VarT_AssigneeFirstName, VarT_AssigneeLastName, VarT_Subject and VarT_ActivityID to store the data.
3. Drag and drop Record Lookup element (Enter the name To get Assignee details) on the canvas to get the Assignee First Name and Last Name, as shown in the following screenshot

Get Assignee details
Get Assignee details

4. The next task is to get Assignor details. For this drag-and-drop a Record Lookup element (Enter the name To get Assignor details) on the canvas to get the Assignee First Name and Email Address, as shown in the following screenshot

Get Assignor details
Get Assignor details

5. Now we’ll create an email template using the Text Template. Navigate to the Resources tab and add one Text Template to create an e-mail template. Design it as per the business requirements, please refer the following screenshot for more information

Email Templates
Email Templates
  • Visual Flow Text Templates also allow you to use HTML code.

6. Now we will use the Send Email static action to send out an e-mail to Assignor. Navigate to the Palette tab and drag-and-drop the Send Email static actions onto the canvas. Please refer the following screenshot for more details

Send Email
Send Email

7. Finally your Flow will look like the following screenshot

Email notification for Completed Tasks

8. Save your flow with name Email notification for Completed Tasks and close the canvas. Don’t forget to Activate the Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on the Task object to launch a Flow. To create a Process on the Task object follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder  and click on the New button, Enter Name, API Name and then click on the Save button

Define Process Properties
Define Process Properties

2. The next step is to add entry criteria. For this click on Add Object, select Task object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button

Evaluation Criteria
Evaluation Criteria

3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Task].Status Equals Completed), also select the check-box Do you want to execute the actions only when specified changes are made to the record?  and click on the Save button, as shown in the following screenshot

Process Criteria
Process Criteria

4. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case Flows) , and then fill out the fields to define the action, as shown in the following screenshot

Add action – Flows
Add action – Flows

5. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot

Email notification for Completed Tasks

Don’t forget to active the Process by clicking on the Activate button.

Sample Output

Sample Output
Sample Output

Getting Started with Process Builder – Part 25 (Auto Submit Record into Approval Process)

Posted on Updated on

 Approval processAn approval process is an automated process an organization can use to approve records in Salesforce. To submit a record into the approval process, the user has to manually click on Submit For Approval button, as shown in the below Screenshot

Submit For Approval button
Submit For Approval button

The disadvantage of this manual process is, if a user forgets to click on Submit For Approval button, it won’t auto send records into the approval process and it may cause an issue sometime. In this article I am going to discuss how you can use Process Builder to automate this process.

Business Use case :- Warren Mason is working as System administrator in Universal Container. He has created  an approval process on Campaign object, this will work only for those campaigns where Budgeted Cost is greater than $1M. Now he is looking for a way so that the campaign record will be automatically submitted into the approval process without any manual intervention, when it meets the entry criteria.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Submit for approval action to solve the above business requirement. You can also use Apex Triggers to solve the above business use case. I assume that you have created an active approval process on Campaign object, as shown in the following screenshot

Approval process on Campaign
Approval process on Campaign

Follow the below instructions to create a Process Builder to solve the above business requirement

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder, then click on the New button. It will open a pop-up for you, where you have to enter the Name, API Name and then click on the Save button, as shown in the following screenshot

Define Process Properties
Define Process Properties

2. The next step is to add entry criteria. For this click on Add Object, select Campaign object and for the entry criteria, Select when a record is created or edited, as shown in the below screenshot, once you are done click on the Save button

Evaluation Criteria
Evaluation Criteria

3. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions  (In this case set [Campaign].BudgetedCost IsChanged True) and click on the Save button, as shown in the following screenshot

Process Criteria
Process Criteria

4. The next step is to add an Immediate action to Process. Click on Add Action (Under Immediate actions), Select the type of action to create (In our case select Submit for Approval) and enter the details mentioned below

  • Enter the meaningful Action Name
  • Object Name will automatically populate based on Evaluation Criteria
  • For an Approval Process selection there are two options, i.e. Default approval process and Specific approval process. This drop-down allows you to select, whether you need to submit the record through the default approval process or through a specific approval process.
  • Submitter :- It also allows you to specify the submitter for approval request and receives all related information.
  • Submission Comments:- It also allows you to specify the submission comments. Submission comments appear in the approval history. They also appear in the initial approval request email if the template uses the {!ApprovalRequest.Comments} merge field.

Finally it will look like the following screenshot

Add action – Submit for Approval
Add action – Submit for Approval

5. Once you are done, click on the Save button, it will redirect you to Process canvas. Finally the Process will look like the following screenshot

Auto Submit Record into Approval Process

Don’t forget to active the Process by clicking on the Activate button.

Proof of concept

1. Now create a new campaign via the UI

New campaign
New campaign

2. Once you are done click on the Save button, Process Builder will auto submit this record in the approval process.

A few points to remember

1. If you have selected Let the submitter choose the approver manually option under step-3 (select assigned approver ) in your approval process, then Process builder won’t work. You will get a run time error i.e. No applicable approval process found.

Select Approver
Select Approver

2. The record is submitted to the default approval process, and there are no active approval processes for the record’s object type.
3. The record is submitted to the default approval process, and it doesn’t meet the criteria for any of the approval processes for the record ’ s object type.
4. The record is submitted to a specific approval process, and it doesn’t meet the entry criteria.