Validate Email Addresses using Sage CRM Client Side API

By | March 31, 2015

In our earlier posts, we had explained how Email Addresses and Phone Numbers can be validated by adding JavaScript code. However Sage CRM Client Side API Library methods can be used to validate email.
New Stuff: Apply Caption Properties using Sage CRM Client Side API
Kindly allow me to elaborate in more detail. Consider you need to validate an email address on the Emails tab of Company or Person; then you need to follow the below steps.
1) Navigate to Phone/Email Translations and add below lines of code into the Translations such that Regular Expression to validate email address function will be called as soon as Phone/Email screen is loaded for entering details on screen.
<script>
crm.ready(function ()
{
if (!crm.validateEmail(“emai_emailaddressbusiness”)) {
crm.errorMessage(“This email is not valid”);
}});
</script>
2) Email address fields are not accessible through the UI, so this function will use as a RegExp to test the value of the field name and return a boolean to indicate if it’s a valid email address format or not.
Above line of code can be added on any Standard or Custom screen of Sage CRM where you need to validate email addresses.
Also Read:
1) Get Active tab through Client side scripting
2) Add Print Button to Print Entity information in Sage CRM v7.2
3) Information and Error Message feature in Sage CRM v7.2
4) Avoid scrolling with Collapse Screen Feature in Sage CRM7.2
5) Display Background Color on Required Fields in Sage CRM v7.2