Skip to main content
I am pretty new to flows. I am trying to validate an email address. The email input that comes from salesforce allows for an email without a .com\edu\ect... I am trying to build a decision where it looks to see if the email address matches a regex. I have tried to build a formula for the flow but everything I do says it is invalid. My thoughts are to build the formula and then see if it is true or not in a decision element. Would that be the correct way to do that? 

 

I've created a formula called IsEmailCorrect. It is of type text. In the formula I have

 

REGEX({!PersonEmail.Value},”[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}”)

 

PersonEmail.Value is the name of the element on my screenflow where the person enters an email address. 

 

Any help would be great. Thank you
4 answers
  1. Feb 21, 2024, 7:10 PM

    A note for future lost souls. I tried the formula above and got a warning (screenshot below): "Primary_Email (Screen Component) - The formula expression is invalid: It contains an invalid flow element Primary_Email."

     

    It took me a while to realize that the regex needs to be provided a text string, and it was being provided the email address object instead of its value attribute. So, adding '.value' fixed the problem.

     

    REGEX({!Primary_Email.value}, "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$")

     

    (remember to replace 'Primary_Email' with the API Name of your email field.

     

    Other examples for common regex validations can be found here in the official docs.

     

    Error screenshot:

    A note for future lost souls.

Loading
0/9000