2012-04-15 82 views
0

自定義查找這個代碼在4.0的工作,在2011年,當我嘗試設置查找我得到一個錯誤,與「initializelookuppresence」創建的JavaScript

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年成功嘗試了這一點?

+1

你可以格式化你的代碼塊更清晰?還有,2011? – Matt 2012-04-15 18:29:54

回答

0

您正在完全替換查找控件。它在2011年不會與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」);

我發現the comments in Rhett's post here相當有用的更多細節。

希望有所幫助。

0

我認爲你需要以下

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