选择器过滤(选择客户后联动项目)
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);
}