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
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: