π Workflow Rules vs. Flows: The CONTAINS dilemma
Salesforce veterans might recall how simple life seemed with Workflow Rules when handling comparisons using CONTAINS.
You could just slap in multiple values and call it a day:
β’ Email CONTAINS "@SpamSender.com,@spammy.net,@spammer.org"
However, the shift to Record-Triggered Flows introduces a wrinkle: this doesnβt work anymore.
Per the Salesforce documentation:
βPassing multiple comma-separated values against the CONTAINS operator in the same condition doesnβt evaluate the Process or Flow as intended.β π
The Result?
Your old but elegant one-liner now turns into:
β’ Email CONTAINS "@SpamSender.com"
β’ OR Email CONTAINS "@spammy.net"
β’ OR Email CONTAINS "@spammer.org"
What if you have to deal with a huge list? π€―
One solution is to invert the comparison π
π Instead of checking if Email contains a spammy domain, extract the domain from the email and flip the logic:
Extract the email domain:
β’ MID( Email, FIND( "@", Email ), 255 )
Compare it against your list of spam domains:
β’ SpamDomainList CONTAINS EmailDomain
This approach will work better when dealing with dynamic lists too (say, lists stored in custom metadata or custom objects).
π£ CAVEATS - You have to ensure:
π the Email field is non-empty and properly formatted
π the domains match are case-sensitive
π avoid false positives (improbable but still a concern) by prepending and appending separators (commas) to the email domain and the spam domain list when doing the "contains" comparison