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: Process Builder rakesh

    • 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
    • Getting Started with Process Builder – Part 79 (Auto Remove Managed Package License from a Deactivated User!)

      Posted at 10:20 AM by Rakesh Gupta, on November 21, 2017

      Process Builder in Salesforce is a fantastic way to automate various business processes. It allows you to create a process based on certain criteria that you set. Process Builder can do many things – Create a record, Update records, Post to Chatter, Send an email, etc. A few years back – in September 2015 – I wrote an article Auto Assign package license to New user to show how one can automatically assign managed package license to new users. 

      The overwhelming positive feedback was followed by requests – to write another blog showing how to automatically remove managed package license from deactivated user(s)! Below is one of the sample emails – from a gentleman whom I know not, but would like thank for making the request. For, requests and ideas from my blog readers have immensely contributed towards my mastery of the Salesforce Platform!

      I am looking for a way to automatically delete an installed package members whenI inactivate their User account. Currently, I have to delete the User; then delete them from the installed package. Is there a way via PB and/or Flow? I'd like an automated deletion process that captures all associations.
      
      Thank you,
      Erin Ryan

      In this blog post, I will show you how to leverage process builder to automatically remove managed package license from the deactivated users. Let us start with a business use case.

      Business Use Case

      Martin Jones is working as a System Administrator at Gurukul on Cloud (GoC). At GoC they are using  Conga Composer to streamline and scale their document generation process and Resco to use true offline mobile capability for their Sales and Field Service reps. Martin received a requirement from the management to auto remove managed package licenses as soon as a user’s account is deactivated.

      Solution for the above business requirement

      Before we proceed, let us first ponder – why do we need to automate this process in the first place? 

      On AppExchange, App providers use managed package, partly, to hide the code and implementation logic from customers. Another benefit of a managed package is that app providers can easily push updates to their customers’ org in one stroke.  

      When a user’s account is deactivated is Salesforce, his/her Salesforce license is released and available for reassignment. Such is not the case vis-a-vis the deactivated user’s managed package license. For despite being deactivated, a user’s managed package license is not automatically removed from his/her account; the System Administrator has to manually remove the managed package license from the deactivated user’s account.

      There are a few possible solutions for the above business scenario, but we’ll use  Flow and Process Builder to solve the above business requirement. Before trying to understand the technical aspect of the solution, let us spend some time to understand the general flow of our solution at a very high level. Please spend few minutes to go through the following flow diagram and understand it.

      Read the rest of this entry!

      Posted in Process Builder, Salesforce Flow | 6 Comments | Tagged Activate a Process, Add action Process Builder, Add Criteria Proces builder, Add Managed Package License, Add Managed Package License Salesforce, ADM 201, adm 201 certification, adm 201 salesforce, Auto Add Managed Package License from a Deactivated User, Auto Remove Managed Package License from a Deactivated User, Automation Champion, dev 401, flow, Lightning Process builder, Managed Package License, Platform App Builder, Platform App Builder Exam, Process Builder examples, Process Builder rakesh, Process Builder Salesforce, Process builder use case, Process Criteria, Process management, Remove Managed Package License, Remove Managed Package License Salesforce, salesforce, salesforce Admin exam, salesforce certified developer exam, Salesforce Online Training, Salesforce Platform Developer I, Salesforce Platform Developer I Exam, Salesforce Training, UserPackageLicenseobjects, Visual workflow, when a record is created or edited
    ← 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

    • Salesforce Spring’21 Release Quick Summary
    • Learning Flow
    • Getting Started with Salesforce Flow – Part 58 (Customize Previous, Next, Finish, and Pause Button Label for Screen Flow!)
    • Getting Started with Salesforce Flow – Part 42 (Running a Flow in System Mode)
    • Learning Process Builder
    • Getting Started with Salesforce Flow – Part 11 (Count Number of records in a Record Collection Variable)
    • Getting Started with Salesforce Flow – Part 57 (Adding Validation to Flow Screen Components)
    • Getting Started with Salesforce Flow – Part 24 (Automatically Assign Permission Sets to New User)
    • Add Record to Multiple Chatter Groups - Parsing Multi-Select Picklist fields (Flow)
    • Getting Started with Salesforce Flow – Part 33 (Prior Value of a Record in Record-Triggered Flows)
  • Social Media

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