Flow: How To Use In / Not In Operators
I believe many have been looking forward to the In / Not In operators available in Winter’23 release. This helps us build a flow that can be more efficient than ever! However, it is not perfect yet because it does not support the record collections yet, so we have to implement some workaround in order to use them. Let’s take a look on how to achieve so!
To get a full list of Contacts whose Account rating is marked as Hot.
The official release note has explained the solution very clearly. Since the In/Not In operator only support primitive data type, we will have to build a loop to store all the Account Id into a text collection. Then we will be able to use this collection together with the In/Not In operator. In this example, I will only demonstrate the In operator. Just keep in mind that the Not In operator is the opposite of using In operator.
Partial Flow Chart – Can be incorporated into your own solution
Please wait while flipbook is loading. For more related info, FAQs and issues please refer to DearFlip WordPress Flipbook Plugin Help documentation.
Thanks, Melody. It’s exciting to see Flow get new functionality. But it also makes you appreciate the efficiency of a well-written SOQL query.
I initially thought these new additions would allow us the enter values as when writing a SOQL query. Can you provide a use case, where before it was not possible, and now it is because of this? Thanks Melody, and welcome back (looks like they’re keeping you busy 😁 )
I don’t believe using In or Not In allows Flow Builder to do anything it couldn’t do in the past but it does add efficiency. In the example above, the flow can be done without using In but you would need an additional loop (loop within a loop) and a collection resource to achieve the same result. Once In can be used in record collections, its true purpose will be realized — just like a bind variable in a SOQL query:
Thank you. This is very useful. I do need to spend more time learning about Flows.
Have you encountered the issue where this fails if there is only one record in the collection? Salesforce support is trying to tell me that you can only use the In operator if there is more than one record, but how would I know that ahead of time? This means any flow that uses the In operator needs to check to make sure the collection has more than one value and have an alternative path if it only has one.