Automation Champion

Automating Salesforce One Click at a Time
Automation Champion
  • Home
  • About Me
    • Testimonials
    • Resources
  • Process Builder
  • Salesforce Flow
  • Pardot
  • Apex
  • Training Details
    • Salesforce Administrator
    • Salesforce Advanced Administrator
    • Platform App Builder
    • Lightning Flow
    • Pardot
    • Sales Cloud
    • Service Cloud
    • Community Cloud
    • Hands-on Excercises
  • My Books
  • Contact Me
  • Tag: Salesforce Training

    • Getting Started with Salesforce Flow – Part 44 (Auto Convert Marketing Qualified Leads)

      Posted at 9:13 PM by Rakesh Gupta, on December 1, 2020

      Big Idea or Enduring Question:

      How do you set automation to auto-convert marketing qualified leads? 

      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 Apex code. This article will help you to understand how to automate the lead conversion process using the Lightning Flow. 

      Objectives:

      After reading this blog post, the reader will be able to:

      • Use After-save Record-Triggered Flow to auto-convert marketing qualified leads 
      • Understand @InvocableMethod Annotation
      • Use Schedule-Triggered Flow to call an Apex method

      Business Use Case

      Pamela Kline is working as a System administrator in Universal Container. She has received a requirement from the management to auto-convert marketing qualified  (i.e. leads with Rating = Hot) leads and create an account and contact record.

      Automation Champion Approach (I-do):

      While this can be solved using various automation tools like Apex or Process Builder and Apex, we will use After-save Record-Triggered Flow and call an Apex method. To call an Apex method, add the Call Action element to your flow and select an Apex class with a @InvocableMethod Annotation. It means they allow us to extend the Lightning Flow by writing Apex code that meets certain criteria and then invoking the Apex from our Flows. If the class contains one or more invocable variables, manually enter values or reference field values from a related record. @InvocableMethod Annotation supports bulk operations. Let’s begin the solution for the business use case.
       
      In this article, we will use the call LeadConvert database class from Apex code. Make sure to review it. 
       
      Before discussing it, let me show you a diagram of a Process Flow at a high level. Please spend a few minutes to go through the following Flow diagram and understand it.
       

      Let’s begin building this automation process.

      Guided Practice (We-do):

      There are 2 steps to solve Pamela’s business requirement using Lightning Flow. We must: 

      1. Create an Apex class and test class
      2. Lightning Flow Steps:
        1. Define flow properties for record-triggered flow
        2. Adding an action to Call an Apex Class

      Step 1: Create an Apex class and Test class   

      1. Click Setup.
      2. In the Quick Find box, type Apex Classes.
      3. Clicks on the New button.
      4. Copy code from GitHub and paste it into your Apex Class. 
      5. Click Save.

      Repeat the above steps and click the Test class. You can get the code from my GitHub repo. 

      Step 2.1: Lightning Flow – Define Flow Properties 

      1. Click Setup.
      2. In the Quick Find box, type Flows.
      3. Select Flows then click on the New Flows.
      4. Select the Record-Triggered Flow option and click on Next and configure the flow as follows: 
        1. How do you want to start building: Freeform
        2. Trigger the Flow When: A record is created or Updated
        3. Run Flow: After the record is saved
        4. Object: Lead
      5. Select All Conditions Are Met (AND). 
      6. Set Conditions
        1. Row 1
          1. Field: Lead | Rating
          2. Operator: Equals 
          3. Value: Hot
      7. Choose the Option to Only when a record is updated to meet the condition requirements.
      8. Click Done.

      Step 2.2: Lightning Flow – Call an Apex Class

      The next step is to call the AutoConvertLeads class from flow so that when flow fires it auto-convert the leads.

      1. Under Toolbox, select Element. 
      2. Drag-and-drop Action element onto the Flow designer. 
      3. In the Action box, type AutoConvertLeads.
      4. Clicks on the AutoConvertLeads apex class. 
      5. Enter a name in the Label field; the API Name will auto-populate.
      6. Set Input Values: 
        1. Row 1:
          1. LeadIs: {!$Record.Id}
      7. Click Done.

      In the end, Steven’s Flow will look like the following screenshot: Once everything looks good, perform the below steps: 

      1. Click Save.
      2. Enter Flow Label the API Name will auto-populate.
      3. Click Show Advanced.
      4. Type: Record-Triggered Flow
      5. API Version for Running the Flow: 50
      6. Interview Label: Auto Convert Leads {!$Flow.CurrentDateTime}
      7. Click Save. 

      Almost there! Once everything looks good, click the Activate button.

      Proof of Concept

      Now onwards, if a business user updates the Lead Rating to Hot, Lightning Flow will automatically convert such leads and create an account as well as a contact. 

      1. Currently, the lead Gaurav Pradhan is Open and the Rating is Warm as shown in the following screenshot:
      2. Now we update the Rating to Hot and see the flow magic. 
      3. Flow auto converts the Lead and create an Account and Contact or it.

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

      Process Builder Approach

      Formative Assessment:

      I want to hear from you!  

      What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? 

      Let me know by Tweeting me at @automationchamp, or find me on LinkedIn.

      Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

      Posted in Apex, Process Builder, Sales cloud, Salesforce Flow | 99 Comments | Tagged Activate a Process, Add action Process Builder, Add Criteria Proces builder, ADM 201, adm 201 certification, adm 201 salesforce, After-save flow After save flow, Auto convert Lead, Auto convert Lead in Salesforce, Auto convert Lead using Apex, Auto convert Lead using Apex Trigger, Auto convert Lead using PB, Auto convert Lead using Process, Auto convert Lead using Process Builder, Auto Convert Leads, Auto Convert Leads Apex trigger, Auto Convert Leads Automation Champion, Auto Convert Leads in Salesforce, Auto Convert Leads in Salesforce using APex, Auto Convert Leads in Salesforce using Apex Trigger, Auto Convert Leads in Salesforce using Process Builder, Auto Convert Leads process, Auto Convert Leads Process Builder, Auto Convert Leads process in Salesforce, Auto Convert Leads process in Salesforce codeAuto Convert Leads process in Salesforce code, Auto Convert Leads process in Salesforce Proces, Auto Convert Leads process in Salesforce Process, Auto Convert Leads Rakesh Gupta, Auto Convert Leads Salesforce, Automation Champion, flow, flow builder in salesforce, flow builders, Lightning Flow, lightning flows in salesforce, Lightning Process builder, Platform App Builder, Platform App Builder Exam, Process Builder, Process Builder examples, Process Builder rakesh, Process Builder Sales Cloud, Process Builder Salesforce, Process Builder Service Cloud, Process builder use case, Process Criteria, Process management, sales force automation software, salesforce, salesforce Admin exam, salesforce automation, salesforce automation tools, salesforce certified developer exam, salesforce flows, salesforce lightning flow, salesforce lightning flow examples, Salesforce Online Training, Salesforce Platform Developer I, Salesforce Platform Developer I Exam, Salesforce Training, when a record is created or edited
    • Top 5 Lightning Component Gems of Salesforce Spring’19 Release!

      Posted at 9:30 AM by Rakesh Gupta, on January 8, 2019

      The Lightning Component modern framework is a User Interface framework to develop dynamic web apps for mobile and desktop devices. As is the case with each release, the latest Spring‘19 release is packed with rich features including, the newly added Lightning Component features!

      Currently, Spring’19 release is available under the pre-release program. Sandboxes will be upgraded on 4th and 5th of January. As a result, your organization will get the look and feel of Spring’19 release.

      In case you have not read the entire 429 pages of Salesforce Spring’19 release notes, check out Spring’19 release quick summary and the Spring into Top 10 Lightning Experience Gems of Salesforce Spring’19 Release! written by me. 

      I combed through the release notes and highlighted the added capabilities to the Lightning Component features. Believe me, it was hard to stop at just five! To kick things off, here is my take on the coolest Lightning Component features from Spring’19 release. 

      1) Lightning Web Components (Generally Available):- Now you can build Lightning components using two programming models: Lightning Web Components, and the original model, Aura Components. Lightning web components are custom HTML elements built using HTML and modern JavaScript. Lightning web components and Aura components can coexist and interoperate on a page. To admins and end users, they both appear as Lightning components. To learn more about Lightning Web Component click here. 

      Lightning Locker supports the new Lightning Web Components programming model.

      Read the rest of this entry!

      Posted in Spring'19 Release | 2 Comments | Tagged Aura Page Template Components, Automation Champion, flow, Lightning Experience, Lightning Flow, Lightning Web Components, Lightning Web Components programming model, Navigate to a URL with the standard webPage, Page Reference Type, Process management, salesforce, Salesforce Online Training, salesforce release, Salesforce Spring 19 Release, Salesforce Training
    ← Older posts
    • Search

    • Upcoming Trainings

      Salesforce Administrator Certification
      Salesforce Advanced Administrator Certification
      Salesforce Platform App Builder Certification
      Lightning Flow & Process Builder
      Advanced Lightning Flow
      Pardot Specialist & Consultant Certification
      Sales Cloud Consultant Certification
      Service Cloud Consultant Certification
      Community Cloud Consultant Certification
    • Sponsor #1

    • Sponsor #2

    • Sponsor #3

    • Sponsor #4

    • Order Now!

    • Buy My Book

    • Buy My Book

    • Recent Posts

      • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
      • Streamline Data Collection with Salesforce-Connected Forms
      • Getting Started with Salesforce Flow – Part 56 (Merge Chatter Topics with the Help of Salesforce Flow)
      • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
      • Getting Started with Salesforce Flow – Part 55 (Add or Remove Followers to a Record with the Help of Salesforce Flow)
    • Salesforce ID Converter Build on Lightning Flow

      Converting 15 digit ID to 18 digit Salesforce ID
    • Blog Archives

    • Categories

  • Information

    • About Me
    • Affiliate Disclaimer
    • Contact Me
    • Privacy Policy
  • Top Posts

    • Learning Flow
    • Learning Process Builder
    • Salesforce Spring’21 Release Quick Summary
    • Getting Started with Salesforce Flow – Part 1 (Understand, Create & Use Variables in Flow!)
    • Getting Started with Process Builder - Part 1 (Automatically Create a record)
    • Getting Started with Salesforce Flow – Part 4 (Need to Redirect a User to a New Record?)
    • Getting Started with Salesforce Flow – Part 41 (Create a Survey Using Flow? Why Not?!)
    • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 44 (Auto Convert Marketing Qualified Leads)
  • Social Media

    • View Automationchampion’s profile on Facebook
    • View Automationchamp’s profile on Twitter
    • View Rakeshistom’s profile on GitHub