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
Jeff WellerJeff Weller 

Basic Lead Autolaunched Flow will not Link a related Contact (Based on External ID)

I have done this a million times it seems like... but I do not understand why this is not working.

There is an External ID (Called "HALO ID") on the contact object.
A technician fills out a web-to-lead form online, puts in their Halo ID and Salesforce should Relate the Contact to the Lead.

I troubleshooted the process builder that autolaunches the flow just fine.
Trigger:  Halo ID NOT null && Technician = null
sObject: "Lead" (Lead sobject)

User-added image

User-added image

User-added image

User-added image

User-added image

Please help, thank you!
Jayson Faderanga 14Jayson Faderanga 14
your first element queried a "List" of lead record. In the second element where you are trying to find a Contact, you mapped the contact "Halo_ID__c" with Lead.Lead_Tech_Id__c. that won't work as the first element may possibly contain one or more lead record.
 
Jeff WellerJeff Weller
I'm a newer developer - I don't yet know how to use the sObject Collections and Loops to do it properly. (That's my current learning curve)

Yes, that list is managed. There is not an issue there (it hasn't stopped other flows with exactly the same logic in the past), in the sense that even though we are querying the entire object it will never contain more than 1 record (the submitted record) that has a Tech ID and not a Technician Name. Any bulk entries would have the contacts already related to them and the form can only submit one lead at a time.
Jayson Faderanga 14Jayson Faderanga 14
I see..try to add this on the first element.

create a variable LeadId = {!LeadId}
then on your Process Builder, in the action block..you selected "flow" right..
select the variable LeadId = Id   <--- this is the Id of the lead record that trigger the process builder.
you can remove the tech Id and the technician field on the first element search criteria,..

 
Jeff WellerJeff Weller
Contact Object:
 - Halo ID (External ID)
 - SFID

Lead Object:
 - Tech ID (which is what needs to link the Lead and the Contact, through the Halo ID)
 - Technician (the lookup field that builds the relationship between the Lead and Contact)
 - Lead SFID

Lead is submitted with the Tech ID filled out
SF should query the Contact Object to find the related record (based on the Halo ID matching the Tech ID)
SF should then push that contact into the Technician field.

How do I accomplish this?
Jayson Faderanga 14Jayson Faderanga 14
that makes it more clear :D

create a process builder on Lead Object...
Evaluation Criteria created and Everytime its edited

user formula as the process criteria, it should be like this..(note I used ISNEW() so it'll only fire when the record is created)

ISNEW() && Tech_ID__c Does != null && LeadSource = Web (Optional)

Selected Actions
Launched a Flow

then save it for the meantime.......

create  the Visual Flow

Record Lookup (first element, starting element)
Lookup* Lead

the field for search criteria is Id, create a variable LeadId (it should look like this {!LeadId}

Id equals {!LeadId}

Assign the record's field to reference them in your flow..
Technician__c assign to {!Technician} (variable named Technician)
Tech_Id__c assign to {!TechId} (variable named TechId)



Record Lookup (second Element)

Lookup* Contact

the field for search criteria is Halo Id, create a variable LeadId (it should look like this {!LeadId}

Halo_Id__c Equals  {!TechId}


Assign the record's field to reference them in your flow..

Id equals {!ContactId}



Record Update (Third Element)

Update * Lead

field
Id equals {!LeadId}


field to update

Technician__c equals {!ContactId}



Go back to your Process Builder

on the action block, select LeadId (this is our variable on our flow)

LeadId reference Id <---- this is the Id that triggers the process builder.. when you click on the rectangle box select Lead > Id, I believe it should look like [Lead].Id


I'm sorry I can't provide screenshots...If you have questions, join my meeting..

1.  Please join my meeting.
https://global.gotomeeting.com/join/874260149

2.  Use your microphone and speakers (VoIP) - a headset is recommended.  Or, call in using your telephone.

Dial +1 (571) 317-3122
Access Code: 874-260-149
Audio PIN: Shown after joining the meeting

Meeting ID: 874-260-149

GoToMeeting® 
Online Meetings Made Easy®








 
Jeff WellerJeff Weller
How do I reference a variable in Process Builder? let alone push it to the flow?
I don't understand the following:

"
on the action block, select LeadId (this is our variable on our flow)

LeadId reference Id <---- this is the Id that triggers the process builder.. when you click on the rectangle box select Lead > Id, I believe it should look like [Lead].Id

"

How do I select LeadId on the action block? and i'm assuming the action block is the third part of the Process Builder. (not the object choice, and not the trigger criteria *diamond*)
Jayson Faderanga 14Jayson Faderanga 14
the first block is where you select the Object on this we have Lead
then the diamond block which is called the Node is where you put the criteria then the action block is the true side and the false side.
if the record meets your criteria it will flow on the true side, you can select an action..update records, post to chatter, create a record etc. choose Launched a flow or flow..

then select the name of the flow you created.
on there will be a drop down selection, the system will give you all the variables you have in your flow as a drop down selection...pick "LeadId" the choose reference as operator then choose Lead > Id , after inserting the Id, it should look like [Lead].Id  if I'm not mistaken.. I'm sorry I can't see the exact thing, I'm just imagining it.. I can't login to salesforce to see the exact thing..but that how it should look like.
Jayson Faderanga 14Jayson Faderanga 14
If you have questions, I can call you or join the gotomeeting I have posted. I can do remote through gotomeeting..