Generic function to set default Entity and default view in MultiSelection lookup

*Generic function to set default Entity in Multilookup and Default View
function setDefaultEntityInMultiLookUpAndView(MultiLookUpSchemaName, DefaultEntityObjTypeCode, DefaultLookupEntityObjTypeCode, EntityLookUpImageUrl, ViewGuid) {
document.getElementById(MultiLookUpSchemaName).setAttribute(“defaulttype”, DefaultEntityObjTypeCode);
document.getElementById(MultiLookUpSchemaName).setAttribute(“lookuptypes”, DefaultLookupEntityObjTypeCode);
document.getElementById(MultiLookUpSchemaName).setAttribute(“lookuptypeIcons”, EntityLookUpImageUrl);
Xrm.Page.getControl(MultiLookUpSchemaName).setDefaultView(ViewGuid);
}

 

pass the parameters to the above function like below

setDefaultEntityInMultiLookUpAndView(“<new_lookupFiledName>”, “2”, “2”, “/_imgs/ico_18_2.gif”, “<View Guid>”);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s