Dynamics Crm 365 JS實現Lookup欄位的自定義過濾
阿新 • • 發佈:2022-03-11
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);