1

I have a string in Salesforce that contains the to and from addresses of an email, e.g.:

From: sender@gmail.com to: (recip1@yahoo.com, recip2@icloud.com)

A process should set a picklist to internal if that string does only contain @gmail.com and @yahoo.com and set it to external if the string contains another domain.

My process builder formula looks like this:

 NOT(REGEX([Attachment__c].Sender2__c,'@(?!gmail||yahoo)\\b\\S+'))

However, the process always sets the flag to internal right now, no matter if the string contains an external domain or not.

On regextester.com, my expression works correctly: enter image description here

How can I make it work in process builder?

3

The REGEX formula will match if, and only if, the entire string matches the pattern. What this means is that you need to include a wildcard at the beginning:

 NOT(REGEX([Attachment__c].Sender2__c,'.+@(?!gmail|yahoo)\\b\\S+'))
                                       .+ here means match any number of characters
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.