• Jonathan LaRosa
  • NEWBIE
  • 5 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 1
    Replies
I'm trying to compare 2 lists using flow. I'm not an apex developer and would prefer to do this entirely with clicks. I've tried to do this using 2 fast lookups and then nesting one loop inside the other. The first lookup grabs a set selection of contacts and places into an sobject collection. The second grabs a set of account records and places into a separate sobject. I then start a loop through the contacts and a loop through the accounts. If the accountid=account.id I check a condition. If that condition is true I go to the next contact. If false, it adds the record to new collection variable. If the accountid<>account.id, I loop to the next account.
For me, I call that a "nested loop".
What I'm finding is the inside loop (the one through the accounts) isn't restarting when I go back to next contact. I've turned on debug and I see the iteration of the account loop doesn't restart. Even with ordering the original collections by the accountid/account.id, I'm not getting the desired results.
My questions are: 1) is there a better way to do this type of check? (I want to be able to use nested loops in other items too) and 2) is there a way to get the loop to restart from the original iteration.
Restrictions: there will be more than 100 records, so I will run into limits.
Here's an example of the flow. Please note that HH is the "account" object for me.
Flow with nested loop

 
I'm trying to compare 2 lists using flow. I'm not an apex developer and would prefer to do this entirely with clicks. I've tried to do this using 2 fast lookups and then nesting one loop inside the other. The first lookup grabs a set selection of contacts and places into an sobject collection. The second grabs a set of account records and places into a separate sobject. I then start a loop through the contacts and a loop through the accounts. If the accountid=account.id I check a condition. If that condition is true I go to the next contact. If false, it adds the record to new collection variable. If the accountid<>account.id, I loop to the next account.
For me, I call that a "nested loop".
What I'm finding is the inside loop (the one through the accounts) isn't restarting when I go back to next contact. I've turned on debug and I see the iteration of the account loop doesn't restart. Even with ordering the original collections by the accountid/account.id, I'm not getting the desired results.
My questions are: 1) is there a better way to do this type of check? (I want to be able to use nested loops in other items too) and 2) is there a way to get the loop to restart from the original iteration.
Restrictions: there will be more than 100 records, so I will run into limits.
Here's an example of the flow. Please note that HH is the "account" object for me.
Flow with nested loop