This feels like it should be very simple, but every time I try to do this it eludes me. I'm posting screencaps of how it is set up, it's nothing sensitive.

  • The basics of what we're trying to do is get opportunities with no last activity date or a last activity date older than 30 days.
  • Then we want to check the contacts associated with them.
  • We then only update the subset of the two.

I've tried a few different iterations of this.

  • I'm thinking I need to use collections to do it, but the problem with collections is I can't reference the items in the collection so I can't subset my contacts!
  • When I tried to do single record, then it only updates 1 record.
  • If I try to loop it, I get this crazy error that I've done too many soql queries.

So I'm really at a loss. I'm just posting what I have now and hopefully I can get a little assistance/education on how I'm misunderstanding salesforce flows.

enter image description here

That's how we have it set to run, because we can't use environmental variables to limit it to the date range we want.

Then we get the opportunity records that have the filters we want:

enter image description here

Then we grab the contacts that would fit the criteria:

enter image description here

Finally we want to test out if our automation is working by updating this custom date field with today's date:

enter image description here

1 Answer 1


So, for the moment, Flow doesn't support IN operator on record collections which is what you are looking for

You'll need to add to your org this handy set of collection processor Apex actions from UnofficialSF.com

The specific one you need is Extract Strings From Collection (with Dedupe)

Insert this action before the Update Records

You'll pass it the collection of Contacts and ask it to return a collection of text fields (specifically, Contact.AccountID). Put this in a variable called contactAccountIds

Now, the Update Records can use as a condition

AccountId IN contactAccountIds

and you're done. No messy flow looping. The collection operators in this package are so, so useful until such time (I'm writing this as of Spring 23) subsume them.

You must log in to answer this question.

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