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

创建dynamics CRM client-side (九) - 用JS来获取look up 信息

时间:2019-07-09 10:56:45      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:com   UNC   span   object   style   attr   uid   img   develop   

我们用以下的代码可以获取到look up 的信息。

 

大家可以查看微软文档来查看更多关于 lookup object的信息

https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/xrm-utility/lookupobjects

 

我们可以使用 下面代码来展示信息:

formContext.ui.setFormNotification("Guid of the Account: " + accountGuid, "Info", "notification1");

 

// Converting functions to Namespace Notation
var Sdk = window.Sdk || {};
(
    function () {
        this.formOnLoad = function (executionContext) {
            var formContext = executionContext.getFormContext();
            //var firstName = formContext.getAttribute("firstname").getValue();
            //alert("Hello World " + firstName);

            var lookupAccountArray = formContext.getAttribute("parentcustomerid").getValue();

            if (lookupAccountArray !== null && lookupAccountArray[0] != null) {
                // you will get entity type, name and id
                var accountGuid = lookupAccountArray[0].id;
                var accountName = lookupAccountArray[0].name;
                var accountType = lookupAccountArray[0].entityType;

                formContext.ui.setFormNotification("Guid of the Account: " + accountGuid, "Info", "notification1");
                formContext.ui.setFormNotification("Name of the Account: " + accountName, "Info", "notification2");
                formContext.ui.setFormNotification("Type of the Account: " + accountType, "Info", "notification3");
            }
        };
    }
).call(Sdk);

 

技术图片

技术图片

创建dynamics CRM client-side (九) - 用JS来获取look up 信息

标签:com   UNC   span   object   style   attr   uid   img   develop   

原文地址:https://www.cnblogs.com/TheMiao/p/11155867.html

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