Learning Flow: Lead De-duplication through Visual Workflow



Lead is the identification of a person or entity that has the interest to purchase a product or service from your organization. People who managing Lead in Salesforce, they face one major problem i.e. Lead De-duplication. Salesforce does not have any out-of-box app that will check based on some parameter for duplicate lead while creating new Lead in system. You can achieve this functionality by using Visualforce page and Apex, but it’s requiring knowledge of both. In this article I will focus on how to achieve this functionality by using Visual workflow.
Business Use case :- Higher management in Universal Container wants to build functionality for Lead De-duplication where they want to enter Company Name on first screen and if any company exists with same name display all, user will select one and redirect them to selected lead’s detail page. In case if lead is does not exist with Same Company Name it redirect them to New Lead page with auto populate Company Name that user entered as search criteria.
Solution of above business requirement
First of all I want to say thanks to Andrew Johnson for his blog Making a Dynamic Choice That Much Better . In this blog I will use Visual workflow to solve above business requirement. To develop this functionality follow the below instructions
  • Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows
  • Click on New Flow, it will open flow canvas for you
  • Drag and drop a Screen ( Give the name Get Name) on window, and click on Add a Field to enter Company Name from user as shown in below screenshot

  • Next is to check whether search entries return one or multiple result. Based on that we will redirect user to respective screen. To do that I used next two look up Pass 1 and Pass 2.
  • In Pass 1 lookup I am comparing  Company Name (User Input) with Company field of Lead and store ID in FirstID variable, as shown in below
  • In Pass 2 I am checking multiple records with same company name and store id in SecondID variable. To understand this concept in detail you can browse Andrew Johnson for his blog Making a Dynamic Choice That Much Better.

  • Next work is to create a decision, If multiple records exist with Same Company Name we will redirect user to a screen from where he/she can choose existing record. If no record exists with same Company Name we will redirect user to New lead creation page. Drag and drop decision element in canvas and create two outcome Yes and No as shown in below screen shot

  • Now we will create screen and it will display multiple lead records. Drag & drop screen into Canvas and give name Dynamic choice display, Add dynamic Choice field and select
    1. Create a choice for object :- Lead
    2. Field :- Company equal to Company_Name (Variable)
    3. Choice label :- Name (Lead Name)
    4. Save ID of the record in variable ThirdID
You can take help from below screenshot

In the next Screen we will display selected record (with a link from where user can open selected record). To do that Drag & drop screen into Canvas and give the Name DisplayThirdID , add one output field and create a URL same as below screenshot

  • Now we will create two Screens. First Screen display no record found with entered Company Namemessage and then we will redirect user to next Screen where her/she found a link to create new Lead. To do that first Drag & drop Screen into Canvas and just display a message (No record exist with nameCompany_Name ).Again drag & drop screen into Canvas and give the name toOpenNnewLeadPage, add one output field and display field and display link

Finally it will look like below screenshot

  • Save this Flow and create one VisualForce Page and reference your flow
<apex:page standardController=”lead”>
<flow:interview name=”YourFlowName”/>
</apex:page>
  • Overwrite your New Button available on Lead object. To do that follow the path Name | Setup | App Setup | Customize | Leads | Buttons, Links, and Actions | New Overwrite it with VisualForce page that you created in last step.
Now it’s time to test this feature
  1. First we will try to enter Campany name that already exist in system. To Create New lead, navigate toLead tab and click on New Button, it will open visualforce page and enter Company Name ( In our case enter Salesforce.com) for which you want to create lead and click on Next, as shown in below screenshot

If Lead with same Company Name exist in system, it will return whole list and click on Next, as shown in below screenshot

You will redirect to a new Screen where link will appear and click on it, to go to selected record detail page

2. Now  we will create lead with Company name that is not exist in System.
  • Again create new record by navigating Lead tab and click on New Button, Enter Company Name as Universal Container and click on Next,, as shown in below screenshot

  • It will redirect you to screen where message will display like below screenshot and click on Next

  • Now a screen will appear with link, click on the link to create New Lead

Note:- You can add more fields on screen first as per your requirement to find lead records.

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget