• Dynamics Crm 365 JS实现Lookup字段的自定义过滤


    条件覆盖:

    1.实现方法很简单,在Form的OnLoad事件加上preFilterLookup

    function preFilterLookup() {
           Xrm.Page.getControl("new_postingid").addPreSearch(function () {  // child field
               addPostingLookupFilter();
           });
      }

    2.用addCustomFilter来控制

    function addPostingLookupFilter() {
           var gl = Xrm.Page.getAttribute("new_special_gl_indicatorid").getValue(); // parent field
           var fetchXml = "<filter type='and'><condition attribute='new_special_gl_indicatorid' operator='eq' value='" + gl[0].id + "' /></filter>";
          Xrm.Page.getControl("new_postingid").addCustomFilter(fetchXml); // child field
      }

    全部覆盖:在onload执行

    let entityName = "account";
            let viewDisplayName = "可用客户";
            let lookupControl = Xrm.Page.getControl(attributeName);  //字段名
            if (lookupControl == null) {
                return;
            }
            let id = '{2443A0FF-7988-43BC-849B-156F9B93FAD7}';
     
            let fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>"
                + "  <entity name='account'>"
                + "    <attribute name='accountnumber' />"
                + "    <attribute name='name' />"
                + "    <attribute name='accountid' />"
                + "    <link-entity name='scc_team_for_cust' from='scc_cust_id' to='accountid' link-type='outer' alias='stfc'></link-entity>";
               + "  </entity>"
                + "</fetch>";
    
            let layoutXml = "<grid name='resultset' object='10013' jump='name' select='1' icon='1' preview='1'><row name='result' id='accountid'><cell name='accountnumber' width='300' /><cell name='name' width='300' /></row></grid>";
            lookupControl.addCustomView(id, entityName, viewDisplayName, fetchXml, layoutXml, false);
            lookupControl.setDefaultView(id);

    更具体的:https://www.cnblogs.com/fengwenit/p/4003496.html

  • 相关阅读:
    Xshell 设置右键粘贴功能
    python中dict操作集合
    mac 设置网页字体
    博客收藏
    memcache 安装与简单使用
    mac安装homebrew
    Graphviz下载 使用
    jekyll 与hexo
    js 汉字排序
    初试gem
  • 原文地址:https://www.cnblogs.com/parkerchen/p/15992300.html
Copyright © 2020-2023  润新知