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
David Kerr 13David Kerr 13 

Flow Builder Get Contact ID of record created during Flow process

I have an autolaunched flow (from a Process Builder on Contact object) that will create a new Contact. I want to get the ID of the Contact just created and reference it on a Lookup on the original Contact record. 

Any recommendations?
Jonathan Crow 6Jonathan Crow 6
When creating the Contact record you are able to store the value of the Id you created in a variable. Check on this trailhead: https://trailhead.salesforce.com/content/learn/projects/build-a-simple-flow/create-or-update-a-contact
Gerax SoteloGerax Sotelo
@Jonathan In that trail, it only shows how to get the ID of an existing record, not the ID of a new record created in the flow or am I missing something?
Jonathan Wright 34Jonathan Wright 34
You're not missing anything. That completely dodges the question and answers a much simpler one. Pretty easy to get the already created ID. You and I both need to know how to store the new ID created in the flow.
Juliana LourencoJuliana Lourenco
Na parte inferior da ação Criar novo registro marque a opção Atribuir variáveis manualmente e armazene o Id novo em uma variável
User-added image
Yosef Eidensohn 22Yosef Eidensohn 22
When you create a new record from a record variable you dont have that option. Referencing the API name of the create element usually does the trick. I have just encountered a situation where the create element has a value of TRUE in debug instead of the record ID of the new record. Has anyone encountered that before?
Barbara ElyBarbara Ely
@yosef I just ran into and resolved the same issue! @Juliana's screenshot was really helpful. First, I selected "Use separate resources, and literal values" as my "How to Set the Record Fields" response even though all the values for my record were stored in a single variable (circled in blue below). Then after assigning field mappings, I had the option to "manually assign vairables" like Juliana pointed out (circled in orange).
User-added image
Hope this helps!
Chris Long 14Chris Long 14
Thanks for this, is there a similar way to retrieve the ids for multiple records created from a collection?
DISCO76DISCO76
@Yosef Eidensohn 22 --- I have also encountered (true) in debug when incorrectly using a Record variable instead of Text to store the newly created record Id in the Manually Assign Variables step. The variable created to Store the Record ID should be Text.
Bobby UzdavinesBobby Uzdavines
If you create a new record using the "Use all values from a record" option, you can subsequently reference the record ID for the newly created record by referencing the original variable used by the "Create" element. In the below screenshots you'll see that the variable used to create the Opportunity is called "OpptoCreate". Then, in the next screenshot I am creating an Opportunity Contact Role that references the Opportunity ID from the variable "OpptoCreate."

Create Opp

Reference Created Opp Variable