function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nicole SackinNicole Sackin 

How to refer to a Lead in a flow

Hello,

I am trying to run a flow that will use a field in a Lead record (specifically, the Lead record that initiates the Process Builder that references this flow).  I have tried using a Lookup field and I've tried creating a variable, but nothing seems to work.

Basically, I am trying to check if the email address in a Lead matches the email address in any existing Contact.  If so, update a field on the Lead with that Contact ID

I am currently working with 
User-added imageUser-added image
Best Answer chosen by Nicole Sackin
James LoghryJames Loghry
Hi Nicole, Looks like you have generally the right idea.

Here's how I would tackle it:
  1. In your Flow designer, go the resources tab and make sure that varLead is marked as either "Input only" or "Input/Output".
  2. Use a "Record Lookup" element to look up the contact by the email address as shown in the first part of your screen shot.
  3. In the fields area of the "Record Lookup" element, use "Id" for the Contact field, and assign to varLead.Related_Contact__c (this contradicts your screen shot a bit)
  4. Create a "Fast Update" element, with Lead as the object, and use the varLead variable.
  5. Mark the "Record Lookup" as the start element in your flow, and connect it to the Fast Update element.
  6. Save and Activate your flow!
  7. Open Process Builder, using Lead as the object, and adjust your criteria as necessary.
  8. In the "Actions" panel, add a new action of type "Flow", and select the flow you just created.
  9. *Important* - In the "Variables" section when you add your Flow to your Process, select the "varLead" variable.  This will show up because we marked the variable as an Input in step 1.  Select reference for the type, and then for the value select the radio for "The record that kicked off this process" 
  10. Save the process and Activate!
That should allow you to kick off your process and have it update the related contact field on the Lead.  Good luck!

All Answers

James LoghryJames Loghry
Hi Nicole, Looks like you have generally the right idea.

Here's how I would tackle it:
  1. In your Flow designer, go the resources tab and make sure that varLead is marked as either "Input only" or "Input/Output".
  2. Use a "Record Lookup" element to look up the contact by the email address as shown in the first part of your screen shot.
  3. In the fields area of the "Record Lookup" element, use "Id" for the Contact field, and assign to varLead.Related_Contact__c (this contradicts your screen shot a bit)
  4. Create a "Fast Update" element, with Lead as the object, and use the varLead variable.
  5. Mark the "Record Lookup" as the start element in your flow, and connect it to the Fast Update element.
  6. Save and Activate your flow!
  7. Open Process Builder, using Lead as the object, and adjust your criteria as necessary.
  8. In the "Actions" panel, add a new action of type "Flow", and select the flow you just created.
  9. *Important* - In the "Variables" section when you add your Flow to your Process, select the "varLead" variable.  This will show up because we marked the variable as an Input in step 1.  Select reference for the type, and then for the value select the radio for "The record that kicked off this process" 
  10. Save the process and Activate!
That should allow you to kick off your process and have it update the related contact field on the Lead.  Good luck!
This was selected as the best answer
Nicole SackinNicole Sackin
Thank you so much James!