CRM JS lookup过滤

选择器过滤(选择客户后联动项目)

function AddCustomerView() {

  var viewId = "{229782D0-1101-48E1-B414-ECB181F97C52}";

var entityname="xz_project";

var viewDisplayname="项目";

var account=Xrm.Page.getAttribute("xz_account").getValue();

var   accountid;

if (account!=null)

{ accountid=account[0].id; }

else{accountid="{049FDC46-3E2E-4d09-8FED-B352F753F1F8}";}

var fetchxml="<fetch version=‘1.0‘ output-format=‘xml-platform‘ mapping=‘logical‘ distinct=‘false‘>"+

 "<entity name=‘xz_project‘>"+  "<attribute name=‘xz_projectid‘ /> "+

  "<attribute name=‘xz_name‘ /> "+   "<attribute name=‘createdon‘ /> "+

  "<order attribute=‘xz_name‘ descending=‘false‘ /> "+ "<filter type=‘and‘>"+

  "<condition attribute=‘xz_customer‘ operator=‘eq‘   uitype=‘account‘ value=‘"+accountid+"‘ /> "+

  "</filter>"+   "</entity>"+   "</fetch>";

var layoutXml = "<grid name=‘resultset‘ " +

                             "object=‘1‘ " +

                             "jump=‘name‘ " +

                             "select=‘1‘ " +  

                            "icon=‘1‘ " +   

                           "preview=‘1‘>" +  

                        "<row name=‘result‘  id=‘xz_projectid‘ >" +

                           "<cell name=‘xz_name‘ width=‘100‘ />" +

                           "<cell name=‘createdon‘ width=‘100‘ />" +   

                       "</row>" +

                       "</grid>";

Xrm.Page.getControl("xz_project").addCustomView(viewId ,entityname,viewDisplayname,fetchxml,layoutXml ,true);

}

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。