• 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,//名称
                    "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。
  • 相关阅读:
    hdu 3068 Manacher算法
    用gitolite新建项目,clone后首次push,可能会出现: git: No refs in common and none specified; doing no
    Linux命令之nano
    linux下git使用记录1 git 提交
    Linux 删除文件夹和文件的命令
    UBUNTU 下GIT的安装
    mysql 常用命令
    mysql 数据类型
    SQL优化
    CSS入门教程——定位(positon)
  • 原文地址:https://www.cnblogs.com/sjsmyy/p/10918454.html
Copyright © 2020-2023  润新知