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

Flow to query a Contact's email and update lookup field on Lead record

I am trying to create a flow that queries all the Contact's records for an email that matches an email on the Lead record and then updates a custom Contact lookup field on the Lead record with the matching Contact. I'm sort of lost as where to start. A fast lookup on the lead or a fast lookup on the Contact record? And which record fields to save in the variable?

Any and all insights or help is appreciated.
Gaurav HandooGaurav Handoo

To achieve this, you would need to have a Process Builder running on either creation/update of Lead, which inturn would invoke a Flow. Input parameters would be LeadId and Email Address (you would need two input type text variables to hold these values).

This flow needs to run fast lookup of Contact, to fetch all the contacts having same Email Address in a Sobject collection. Run this collection to update a counter (Number Type with default value 0) by 1. Thus, at the end of the loop, you will have number of contacts that have been found duplicate.

Post you loop element, you can use Record Update element to update the Lead record with the value you want to update it with.

Hope this helps. Please mark as best answer if it does.