• 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);

  • 相关阅读:
    Lipschitz连续
    免费的论文查重网站
    花瓶的一些记录
    Transfrom笔记
    视频处理笔记
    黑魔法的注意的一些点
    UIScrollView的一些关系
    UILabel中NSAttributedString和其LinebarkModel等属性之间的关系
    lame音频编码注意的点
    AFNetworking的缓存使用
  • 原文地址:https://www.cnblogs.com/z1984/p/3006986.html
Copyright © 2020-2023  润新知