I have a snippet of a flow I am working on below: enter image description here

What I am trying to do is the following:

  • An account record id is passed which then
  • finds all partner accounts to it by getting the account relationship record that has the Partner_Account__c field = record id (account). There could be multiple account relationship records/partner records,
  • which is why i have a loop.
  • Then, I am getting the accountTo account info that is in each account relationship record.
  • From there, in the accountTo account,
    • i am finding the account owner and adding to the account team member related to the account record.

That is what the flow is doing. In other words, i want to add all account partner's owners as Account Team member in the original account.

As you can see from the flow, I have 2 get records and then am doing a dml operation inside the loop. I have done loops several times before, but for some reason in this scenario I dont know how to bulkify this.

How do I add all that user info (account owner) in a collection and update/create that one account team member record? In here i feel like it will create multiple account teams. Can someone please help me improve this flow based on my requirement? Thanks


1 Answer 1


You could look at using a couple of assignments within your loop to complete this.

The first assignment would be to assign the details of the Account Team record that you are currently creating to a Record Variable. The second assignment would be to add that record variable to a Record Collection Variable that you can then use for your inserts.

  • Can you show an example of such bulkification including the detail of how to have a new record (with multiple field assignments) added to the collection within the loop?
    – Phil W
    Commented Apr 30, 2021 at 7:25
  • the other confusing this about this is that the starting loop is an account relationship object collection but it is querying users and account and trying to create one Account team member object with all those users. So all different objects inside the loop. Typically in examples, they all are of one same object. Commented Apr 30, 2021 at 14:53
  • if that can be written in apex where the flow calls the apex then that would be great too if i could get a code sample Commented Apr 30, 2021 at 21:16

You must log in to answer this question.

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