I'm working on a screen flow where I create a record and need to access its Id right after. The Create Records element sets the record fields with the "Use all values from a record" option. The record variable field values are predefined from an assignment element prior to record creation (newUarRecordVar).

Most of the time I use the "Use separate resources, and literal values" option for creating a record, so I'm used to having the option to assign the created recordId to a variable of my choice. However, when creating the record from a record variable, I don't know how to access the Id of the created record. The "Edit Create Records" screen even says at the bottom "After the flow creates the records, ID is set to match the record that was created." and yet when I try to pull the Id of the newly created record (after creation, of course), the debugging menu shows it is null.

I've looked into:

  • Assignment element to assign value "newUarRecordVar.Id" to variable "recordId" (shows newUarRecordVar.Id is null)
  • Set Get Records element to pull record where Id = newUarRecordVar.Id (again, value is null)
  • Setting the created record's Id to a variable in the same Create Record element (when creating from a record variable, this is not an option)
  • Reviewing Salesforce documentation (not very helpful in this regard) (https://help.salesforce.com/s/articleView?id=sf.flow_ref_elements_data_create.htm&type=5)

Ultimately a work around is to create the record from literal values using the predefined values of the record variable, but this defeats the whole point of creating a record variable and I'm baffled that there isn't a straight forward way to create the record from a record variable AND be able to immediately access its Id. I understand the record may not be committed to the database until the interview finishes or a screen is reached, but that is possible when creating a record from literal values, so not sure why using a record variable should be different.

So with all that considered, the question is:

How can I access the record Id of the newly created record from the values of a record variable in the same flow?

Create records element screen

1 Answer 1


Well clearly I was doing something wrong before, because I tried pulling the Id from "NewUarRecordVar.Id" after record creation and now it seems to work just fine.

But in case this is helpful for anyone in the future, to answer the question, you would:

  • Create your record like the screenshot
  • Access the Id with the same record variable you created, and specifically pulling the "YourNewRecordVariable.Id" when you need it
  • Ensure the correct order for each element to define the values of the record variable, create it, and then access it

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .