先在该lookup记录entity的lookup view中添加自己需要的字段,然后在该lookup的Page load中添加如下js代码:
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
function OnAfterAccountSelect()
{
var contactLookup = crmForm.all.jade_employeecode;
if( contactLookup.DataValue != null ) {return;}
contactLookup.AutoResolve = 1;
var applookup = crmForm.all.jade_application;
EmpCode = applookup.items[0].keyValues.jade_employeecode;
contactLookup.innerText = EmpCode.value;
/* for lookup field
contactLookup.AutoResolve = 1;
var accountLookup = crmForm.all.parentaccountid;
primaryContact = accountLookup.items[0].keyValues.primarycontactid;
contactLookup.SetFocus();
contactDiv = document.all.primarycontactid_d.getElementsByTagName("DIV")[0];
contactDiv.innerText = primaryContact.value;
contactLookup.Lookup( true , true , primaryContact.value , true );
*/
}
function OnCrmPageLoad()
{
crmForm.all.jade_application.attachEvent( "onafterselect" , OnAfterAccountSelect );
}
OnCrmPageLoad();