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
Rick Paske 18Rick Paske 18 

Process Builder to launch Flow when creating or updating a Lead

I am trying to kick off a Flow using a Process whenever a Lead is created or edited.  The Flow does a lookup to an Object that collects email addresses that have bounced in our marketing platform, then returns a value based on whether the email address is bounced, unsubscribed, missing or other.

The combination of Flow and Process works well on a Contact record.  The same combination does not work on a Lead.  My question is whether this is a bug in Salesforce or whether there is a purposeful limitation here.  I have not been able to find the problem listed anywhere and my support case was closed because they don't provide advice on how Process Builder works (?!?).

The Process runs on the Lead object when created or edited.
The first (and only) decision branch has "No criteria - just execute the actions!"
The Immediate Action type is Flow and I can select the appropriate autolaunched Flow.
The Flow Variable can be selected; it is an sObject variable.
The Type is Field Reference.
The Value is where the problem lies.  I expect a selection box to "Select the Lead record that started your process" or "Select a record related to the Lead".  Instead, I get a "Select a Field" box with options like "Converted Contact ID >", "Created by ID >", etc.  There is no selection for Id, LeadId or anything similar, nor any way to edit the Value field directly.

Has anyone else experienced this and is there a solution?
 
Gaurav HandooGaurav Handoo
Hi Rick

You would need to set an input variable (simple variable or SObject Variable) in your flow capturing the Lead id as well. Based on the description that you have provided looks like you are only capturing Contact Id and that too in Sobject variable (which will always point to Contact object). Following steps might help you fix your problem:
  1. Create three variables:
    1. One Text variable (Let's call this VId for now) to just hold the Id
    2. Another Text variable (Let's call that VT for now) to figure out which PB invoked the flow
    3. One Sobject Variable for Lead (similar to the one you have for Contact)
  2. From your PB (for either Lead or Contact), assign the record Id to the VID and pass the Object Name in VT.
  3. At the beginning of the flow, add a decision box to check whether VT contains Lead or Contact
  4. Assign the value from VID into either of the Sobject variable (for Lead or contact)
  5. Replicate the steps for contact
Let know if this solution works.

Cheers!!

Gaurav