首页 > 其他 > 详细

创建dynamics CRM client-side (五) - 使用regular expression (正则表达式)来检查phone number

时间:2019-07-08 14:41:02      阅读:96      评论:0      收藏:0      [点我收藏+]

我们这次要使用account, 让我们首先重建一个JavaScript。 建议每个entity都创建专属的js

技术分享图片

 

// Converting functions to Namespace Notation
var Sdk = window.Sdk || {};
(
    function () {
        this.formOnLoad = function (executionContext) {
        };

        this.MailPhoneOnChange = function (executionContext) {
            var formContext = executionContext.getFormContext();
            var phoneNumber = formContext.getAttribute("telephone1").getValue();

            var expression = new RegExp("/^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$/im");
            if (!expression.test(phoneNumber)) {
                alert("The phone number entered should use correct format");
            }
        };
    }
).call(Sdk);

 

重新创建web resource 然后在account entity中添加web resource。

 

技术分享图片

 

 

save 和publish之后, 我们看到已经保存

 

技术分享图片

 

创建dynamics CRM client-side (五) - 使用regular expression (正则表达式)来检查phone number

原文:https://www.cnblogs.com/TheMiao/p/11150296.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!