This post talks about formatting phone number is US style. The code already available in CRM v4 SDK Guide, however I have re-written the same thing in CRM v2011 model. It only part of code which is different here in the usage of context class available in XRM pattern. function validatePhone() {  var phone = Xrm.Page.data.entity.attributes.get("telephone1"); var sTmp = phone.getValue().replace(/[^0-9]/g, ""); phoneRegex = /^d{10}$/;  if(!sTmp.match(phoneRegex)) { alert("Phone must contain 10 numbers.") ; } else { switch(sTmp.leng...