Add formatPhoneNumber function onChange Event of “your mobile attribute”
function formatPhoneNumber() {
var phoneNumber = Xrm.Page.getAttribute(“new_mobile”).getValue();
if (typeof (phoneNumber) != “undefined” && phoneNumber != null) {
if (phoneNumber.getValue() != null) {
var sTmp = phoneNumber.getValue().replace(/[^0-9]/g, “”);
phoneNumber.setValue(sTmp.substr(0, 5) + ” ” + sTmp.substr(5, 6));
}
}
}
UK PHONE NUMBER VALIDATION JAVASCRIPT IN MS CRM 2015
Posted in Blog