Use a Single Assignment Element to Add Records to Collection in Flow

#1MinuteTip Do you know you don’t need to use two “Assignment” elements to add records to collection in Salesforce Flow.

Normally we use two “Assignment” elements. In the first assignment element, we assign the values to a resource of a single “Record” type.

And then we “Add” the record to another resource of “Record” collection type. This is how our flow normally looks.

Using two assignment elements to add records to collection

But rather than doing this, we can just add the record to the collection as the last entry in the 1st assignment element. Check this out.

But there is one niggle with this approach. If you need to update your flow to assign more values to the single record resource, you will need to remove the last line that adds the record to the collection and ensure that all values are assigned before adding the record to the collection. This is because, currently, you can’t reorder lines in the assignment element.

Introducing Mastering Salesforce Flows Training Course

Liked this post? We are now offering a complete self-paced, video-based training course on Mastering Salesforce Flows. The course comes with downloadable step-by-step PDF guides, unlimited access, free upgrades, community discussion area, free preview and more. For more details, please click here.

Need Help with Flows?

Need advice on Flows? I also offer advisory & consulting services on Salesforce Flows. So, whether you want to create new Flows or migrate existing automations (Workflow Rules, Process Builder, Triggers) to Flows, I can help you analyze, design, plan & review. To initiate a discussion, please submit the contact form here stating your requirement or schedule a discussion at this URL.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
Introducing All Access Pass