Category: Sales cloud

When there is a chance of further negotiations with a lead, it can be converted into an account,contact, optionally an opportunity. In short, once the lead status has reached a certain stage, it can be qualified as a potential. On conversion, all the lead details are transferred in creating an account, contact and optionally an opportunity. The lead conversion process is a manual process, if you want to automate it then you have to use Apexcode. This article will help you to understand how to automate lead conversion process using the Process Builder. Let’s start with a business use case.

Business Use Case

Pamela Kline is working as a System administrator at Universal Containers (UC). She had received a requirement a to auto convert marketing qualified leads (i.e. leads with Rating equals Hot) and create an account and contact record.

Solution for the above business requirement

There are few possible solutions for the above business scenario, but I’ll use Apexand Process Builder to solve this. Before proceeding ahead, you have to understandLeadConvert Classin Salesforce. To call anApex method, add Apexaction to your process and select an Apex class with an @invocable method Annotation. It allows us to extend theProcess Builderby writing Apexcode that meets certain criteria and then invoking the Apex from our Process. If the class contains one or more invocable variables, manually enter values or reference field values from a related record. @InvocableMethod Annotation support bulk operations.

Apex Method

Now, we have to understand a new Apex annotation i.e.@InvocableMethod. This annotation lets us use an Apex method as being something that can be call from somewhere other than Apex. The AutoConvertLeadsclass contains a single method that is passing the ids of the Leads whose Rating changed to Hot. Create the following class in your organization.

Modify the above class as per your business requirement. Follow the below instructions to create a Process for the above business requirement.

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

2. The next step is to add entry criteria. For this click onAdd Object, selectLead 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 theSave button.

Evaluation Criteria

3. The next task is to add ProcessCriteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions(In this case set [Lead].Rating Equals Hot as shown in the following screenshot.

Process Criteria

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

Add Action – Apex

Under Apex Classsection, It will list out all the classes that contain methods annotated with @InvocableMethod Annotation.

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

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

It’s time to test this feature

1) Navigate to the Lead tab, identify theLead record and click on Lead Name to open record detail page, as shown in the following screenshot.

Sample Lead

2) Now update theRating to Hot, as shown in the following screenshot.

After Update – Rating to Hot

Once you are done, click on the savebutton, It will display the similar screen as shown in the following screenshot

Converted Lead

Note: – I will suggest you to implement this first on your developer org, test it and then move it to production. The same approach will work for case assignment rule. Download Apex and Test class from GitHub.

If you have feedback, suggestions for posts or need more information about Salesforce online training program running by me. Say hello and leave and message to me!

An Opportunity team is a set of users that usually work together on an opportunity. A typical Opportunity Team might include the account manager, the sales representative, and a pre-sales consultant. In Salesforce a user can follow Chatter groups or Records. As of now, Salesforce does not have any out of the box functionality to auto follow records when a user is added to a team or etc., apart from the Automatically follow records that you created.Let’s start with a business use case

Business Use Case

Rachel Gillett is working as System administrator in Universal Container. She has received a requirement from the management when a new user is added to the Opportunity team, then auto adds him as Opportunity follower.

Solution for the above business requirement

There are a few possible solutions for the above business scenario, but we’ll use Flowand Process Builder to solve the above business requirement. Follow the below instructions to create a Process Builder andFlow to resolving the above business requirement

1.click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows2.Click onNew Flow, it will open the Flow canvas for you. Now create an SObject Variable Sov_OpportunityTeamMemberto store the Opportunity Team Member data (we will pass the value through Process Builder), as shown in the following screenshot

SObject Variable

3. The next step is to use EntitySubscription object to check whether the Opportunity team member is already following the Opportunity or not. To do this drag-and-drop a Record Lookup (Enter the name Check follower detail) onto the canvas and map the fields according to below details

Select Object EntitySubscription

For criteria selectParentId= {!Sov_OpportunityTeamMember.OpportunityId} andSubscriberId= {!Sov_OpportunityTeamMember.UserId}. Save the record Id in one Text variable as shown in the following screenshot

Check follower detail

4. Based on{!VarT_SubscriberDetail}we will decide whether we have to add a new Opportunity Team Member to Opportunity follower or not. Drag-and-drop a Decision Element (Enter the name Add as follower or skip) onto the canvas and map the fields according to the following screenshot

Add as a follower or skip

5.The final step is to add a new opportunity team member to Opportunity follower. To do this drag-and-drop Record Create element (Enter the name Opportunity team member to Opportunity follower) onto the canvas and map the fields according to below details

Select Object EntitySubscription

For criteria selectParentId= {!Sov_OpportunityTeamMember.OpportunityId} andSubscriberId= {!Sov_OpportunityTeamMember.UserId}, as shown in the following screenshot

Opportunity team member to Opportunity follower

6. Finally, yourFlowwill look like the following screenshot

7. Saveyour flow with nameAdd OTM to Opportunity follower and close the canvas. Don’t forget to Activatethe Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on theOpportunity Team Member object to launch a Flow. To create a Process Builder on theOpportunity Team Member 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 button2. To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear where you have to enter the Name (Use Add OTM to Opportunity follower PB as name), API Name and Description as shown in the below screenshot

Define Process Properties

3. Click onObjectnode to add object and then selectOpportunity Team Member object. For the entry criteria, Select onlywhen a record is created, as shown in the below screenshot

Evaluation Criteria

4. The next task is to add ProcessCriteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions(In this case select No criteria—just execute the actions!) and click on the Save button as shown in the following screenshot

Process Criteria

5. The next step is to addan Immediate action to Process. Click onAdd 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

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