Dynamic CRM 365学习历程--使用JS进行界面的取值和赋值

Posted sjsmyy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Dynamic CRM 365学习历程--使用JS进行界面的取值和赋值相关的知识,希望对你有一定的参考价值。

使用JS进行界面的取值和赋值

            function createCharge()
            {
            debugger;
            var new_name=Xrm.Page.getAttribute("new_name").getValue();
            //客户名称
            var new_accountid = new Array();
            new_accountid = Xrm.Page.getAttribute("new_accountid").getValue();
            if (new_accountid != null) {
                var accountname = new_accountid[0].name;
                var accountid = new_accountid[0].id;
                accountid=accountid.replace("{","").replace("}","");
                var entityType = new_accountid[0].entityType;
            }
            //套餐名称
            var new_packageid = new Array();
            new_packageid = Xrm.Page.getAttribute("new_packageid").getValue();
            if (new_packageid != null) {
                var packagename = new_packageid[0].name;
                var packageid = new_packageid[0].id;
                packageid=packageid.replace("{","").replace("}","");
                var entityType = new_packageid[0].entityType;
            }
            //折后总价
            var new_discount_price=Xrm.Page.getAttribute("new_discount_price").getValue();
            //实付金额
            var new_actual_pay_amount=Xrm.Page.getAttribute("new_actual_pay_amount").getValue();
            //支付状态
            var new_pay_status=Xrm.Page.getAttribute("new_pay_status").getValue();

            debugger;
            //页面赋值
            var url = "/CRM/api/data/v9.0/new_charges";
            var data = {
                new_name:new_name,//名称
                "[email protected]":"/accounts("+accountid+")",//客户名称
                "[email protected]":"/new_packages("+packageid+")",//套餐名称
                new_amount:new_discount_price,//折后总价
                new_actually_pay:new_actual_pay_amount,//实付
                new_new_pay_status:new_pay_status//结算状态
            };
            var dataJSON = JSON.stringify(data);
            $.ajax({
                url:url,
                method:"post",
                dataType: "json",
                contentType:"application/json",
                data:dataJSON,
                success:function(resp)
                {
                    debugger;
                },error:function(resp)
                {
                    alert(resp.responseText);
                }
            });
       }
外加博客,转自:https://blog.csdn.net/vic0228/article/details/50909261。

以上是关于Dynamic CRM 365学习历程--使用JS进行界面的取值和赋值的主要内容,如果未能解决你的问题,请参考以下文章

Microsoft dynamic crm安装前需要装啥东西?求一个教程

手机怎么访问 dynamic crm

升级微软 dyanamics软件到 dynamics 365有啥好处

创建一个dynamics 365 CRM online plugin - Asynchronous Plugins

在Microsoft Dynamic 365/2016环境使用LinqPad查询数据(不使用linqpad Microsoft Dynamic 365 Driver)

尝试 Web API Dynamics 365 CRM - 403-禁止错误