zoukankan      html  css  js  c++  java
  • JS操作lookup control

    以contact的parentcustomerid为例,它是一个lookup field。lookup type为account和contact。默认type为account

    如果要设置默认type为contact的话,可以document.getElementById("parentcustomerid").setAttribute("defaulttype", "2"); // 2 是contact object type code

    如果lookup type为account和contact,可以document.getElementById("parentcustomerid").setAttribute("lookuptypes", "1, 2");

    设置default view可以Xrm.Page.getControl("parentcustomerid").setDefaultView("E88CA999-0B16-4AE9-B6A9-9EDC840D42D8");

    如果想禁止用户选择其他的view,可以document.getElementById("parentcustomerid").setAttribute("disableViewPicker", "1");

    为lookup字段添加一个自定义视图 (addCustomView

    var viewId = "{C7034F4F-6F92-4DD7-BD9D-9B9C1E996380}";

    var viewDisplayName = "SDK Sample View";

    var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>

                                          <entity name='systemuser'>

                                            <attribute name='systemuserid' />

                                            <attribute name='fullname' />

                                            <attribute name='businessunitid' />

                                            <order attribute='fullname' descending='false' />

                                            <link-entity name='businessunit' from='businessunitid' to='businessunitid' visible='false' link-type='outer' alias='a_89c4efa5341e42d5ac34e759aa182065'>

                                              <attribute name='name' />

                                            </link-entity>

                                          </entity>

                                        </fetch>";

    Xrm.Page.getControl("parentaccountid").addCustomView(viewId, "account", viewDisplayName, fetchXml, layoutXml, true);

  • 相关阅读:
    LG P4213【模板】杜教筛(Sum)
    JZOJ 3447.摘取作物
    JZOJ 3448.公路维护
    JZOJ 4496. 【GDSOI 2016】第一题 互补约数
    jmeter的参数化之函数助手的使用
    window10平台运行jenkins.war的插件安装失败的解决
    jmeter的断言之响应断言的使用
    在虚拟机里安装完mysql后,开启root远程登录权限
    Word Excel PPT 2016从新手到高手
    Oracle 如何停止正在后台执行的impdp/expdp 任务
  • 原文地址:https://www.cnblogs.com/z1984/p/3006986.html
Copyright © 2011-2022 走看看