簡體   English   中英

使用Javascript創建自定義查找

[英]Creating a custom lookup with Javascript

該代碼在4.0中有效,2011年,當我嘗試設置查找的值時,出現“ initializelookuppresence”錯誤

4.0代碼

lookupCell.innerHTML = '<TABLE style="table-layout: fixed" class="ms-crm-Lookup" cellspacing="0" cellpadding="0" width="100%"><TBODY><TR><TD><DIV class="ms-crm-Lookup" tabindex="1011" role="list" ime-mode="auto" ms-crm-hidden-nobehavior><UL style="float: left"></UL></DIV><LABEL class="ms-crm-Hidden-NoBehavior" for=' + id + '_ledit>Related Entity</LABEL><INPUT style="display: inline"  id='+ id +'_ledit class=ms-crm-Hidden-NoBehavior disabled tabIndex=1010 ime-mode="auto"></TD><TD class=Lookup_RenderButton_td width=25><IMG style="ime-mode: auto" id=' + id + ' class="ms-crm-Lookup ms-crm-ImageStrip-btn_off_lookup" title="Click to select a value for Company." alt="Click to select a value for Company." src="/_imgs/imagestrips/transparent_spacer.gif" savedquerytype="" forfield=' + label + ' isDisplayOnly="False"  resolveemailaddress="0" disableviewpicker="0" disablequickfind="0" disablemru="0" allowfilteroff="1" AutoResolve="1" additionalparams=""  defaulttype="2" lookupstyle="single" lookupbrowse="0" lookuptypeIcons="/_imgs/ico_16_2.gif:/_imgs/ico_16_8.gif" lookuptypenames="contact:2:Contact,systemuser:8:User" lookuptypes="2,8" attrpriv="7"  req="1" _lookupstyle="single" _lookuptypes="2,8" _lookupbrowse="0"><A title="Click to select a value for Company." tabIndex=-1 onclick=previousSibling.click(); href="#"></A></TD></TR></TBODY></TABLE>';

有人在2011年成功嘗試過嗎?

您將完全替換查找控件。 在2011年,它使用的HTML與4.0中的HTML不同。 不支持任何與這些控件的HTML混淆的事情。 但是,我在那里看到了一些實體查找類型的重載...而且我想這就是您想要實現的所有內容,對嗎? 實現此功能的(也是不受支持的)方法是覆蓋元素的屬性(而不是整個控件)。

document.getElementById(“ parentcustomerid”)。setAttribute(“ lookuptypes”,“ 2”);
document.getElementById(“ parentcustomerid”)。setAttribute(“ lookuptypenames”,“ contact:2”); document.getElementById(“ parentcustomerid”)。setAttribute(“ lookuptypeIcons”,“ /_imgs/ico_16_2.gif”); document.getElementById(“ parentcustomerid”)。setAttribute(“ defaulttype”,“ 2”);

我發現Rhett在這里的帖子中的評論對於此方面的更多細節非常有用。

希望能有所幫助。

我認為您需要以下

Xrm.Page.getAttribute(“fieldName”).setValue([new {id: idValue, name: textValue, entityType: typeValue}]);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM