此代码在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年有没有人成功地尝试过这个方法?
发布于 2012-04-16 22:12:06
您将完全替换查找控件。它在2011年不是使用与4.0中相同的HTML呈现的。不支持对这些控件的HTML进行任何改动。然而,我在那里看到了一些实体查找类型的覆盖...我猜这就是你想要达到的目标,对吧?实现这一点的方法(同样不受支持)是覆盖元素的属性(而不是整个控件)。
document.getElementById("parentcustomerid").setAttribute("lookuptypes","2");
document.getElementById("parentcustomerid").setAttribute("lookuptypenames",“联系人:2”);document.getElementById("parentcustomerid").setAttribute("lookuptypeIcons","/_imgs/ico_16_2.gif");document.getElementById("parentcustomerid").setAttribute("defaulttype","2");
我发现the comments in Rhett's post here在这方面的更多细节上非常有用。
希望这能有所帮助。
发布于 2012-04-20 11:13:51
我认为你需要以下几点
Xrm.Page.getAttribute(“fieldName”).setValue([new {id: idValue, name: textValue, entityType: typeValue}]);
https://stackoverflow.com/questions/10164220
复制相似问题