Email Format Check

I currently use the following in salesforce to check if the user put in a valid email format:

IF( Text(Temp_Type__c)  = “New Member”, IF(REGEX ( UPPER (  Temp_Lead_Email__c  ) ,"^[A-Z0-9.%±/!#$%&’*=?^’{|}~]+@[A-Z0-9.-]+.[A-Z]{2,4}$") = TRUE, FALSE, 

I would like to do this within skuid before being sent to sales force.  Is there some code that could be put in a UI-field or some script that can check for proper formating?

Hi Bill - This would be another scenario where having the ability to write a custom formula function would make things extremely easy. If you could write a custom formula function, you could write one called “ISVALIDEMAIL” that would apply a regular expression to a value and determine if its valid. From there, you could add a UI Only Field that applied that function and conditionally render your “save” button based on the UI Only field. Vote up custom formula functions here In the absence of custom formula functions, you’re solutions become a little more difficult but it is still possible: 1) Set your save button to “Run Multiple Actions” and in one of the steps in the action sequence before “Save” run a snippet. In the snippet, use a regular expression to validate the email address field and return false if not valid, true if valid. This, in essense, becomes a custom form of validate Fields similar to the stock functionality of validateRequiredFields. 2) Add a UI Only Field called “Valid Email”. Add a snippet called “validateEmail” that runs the regex against the email field and updates the UI Only field. Setup a model change action for the email field to run the snippet anytime the email field changes. Conditionally render/enable the save button based on the UI Only FIeld 3) Write a custom renderer for the Email field and apply the validation as the data is changing or find a third-party javascript library that will do this for you. One thing to note - Validating email addresses using regular expressions is a very difficult task if you validate using the true RFC spec. The regular expression you are using in your SFDC formula field covers “most” scenarios but not all. Just a word of caution depending on what your business requirements are. I’ll leave it to you to determine but you can use your favorite search engine to search for more information about using regexs to validate email addresses :slight_smile:

I get it.  Thanks Barry.