
如果要設置默認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);
網站標題:JS操作lookupcontrol-創新互聯
分享網址:http://www.yijiale78.com/article8/dddpip.html
成都網站建設公司_創新互聯,為您提供云服務器、定制開發、App設計、企業網站制作、網站排名、網站策劃
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯