码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2019-05-24 15:45:10      阅读:577      评论:0      收藏:0      [点我收藏+]

标签:ice   detail   deb   bin   alert   csdn   tle   fun   disco   

使用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,//名称
                "new_accountid@odata.bind":"/accounts("+accountid+")",//客户名称
                "new_packageid@odata.bind":"/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进行界面的取值和赋值

标签:ice   detail   deb   bin   alert   csdn   tle   fun   disco   

原文地址:https://www.cnblogs.com/sjsmyy/p/10918454.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!