Flow: How To Use “Create Records”
There are three possible scenarios when using “Create Records” element in flow, ordered by the frequency of usage:
1. Create one, using separate resources
This is the most-used option by me. You type in the object to create, and then you can manually assign the values using either ad-hoc strings, or resources that you set up earlier in this flow.
By checking “Manually assign variables”, you can save the ID of the created record at a chosen variable.
Use Case | Explanation |
---|---|
You want the variable to have a neat name to reference it later. | When the option is not chosen, the name of the auto-variable will be [ObjectId] From [API name of the Create Records element] (ex. AccountId From Create_New_Account). If you assign the variable yourself, then you can name it NewID for example, which is more readable. |
You want to save this ID in an output-allowed variable. | The auto-created variable is not allowed for output. If you want to use this functionality, create a output-allowed variable and assign it manually. What is input/output-allowed variable? See here! |
2. Create one, using all values from a record
If you have a variable storing all the values you need to create a record, you can also choose “Use all values from a record”.
Use Case | Explanation |
---|---|
You have used Get Records, and you want to clone that record directly or after some modification. | When a Get Records element is used, a variable with the values from that record will be created. If you want to clone that record, simply use this instead of assigning the value field by field. |
3. Create multiple, using record collection
To create multiple records at once, you can only use a record collection variable, and save the required field values into each item in the collection.
What is a collection variable – see here!
Use Case | Explanation |
---|---|
You might have a loop in your flow which will generate several records and save them in a collection, then you create all the records at once . | The outcome is actually the same if you put the Create Records into the loop: However never do this because you might hit the governor limit! (If your loop runs 10 iterations, Create Records will run 10 times). |
How can I access the record Ids created by the “create records” node if it is creating multiple records? I need to be able to display all of the records created.
Hi Katie, the newly created records’ Ids will be stored back to the collection variable which you used to create records, so you can access the new Ids using the same collection. Hope this helps!
Hi Melody,
I tried accessing the inserted collection IDs using the same variable but it is returning “True” value! instead of list of Ids!
Is there any action you can suggest to fix it?