To create a custom view for a lookup, we can refer to this blog post
https://nishantrana.wordpress.com/2010/12/31/filtered-lookup-in-crm-2011/
Here
lookupControl.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
Setting last parameter as “true” sets the custom view as default. However this was not happening in case of connection entity lookups.
So to finally achieve this we did the following
Modify the lookupinfo.aspx “..\Microsoft Dynamics CRM\CRMWeb\_controls\lookup”.
Find the function named handleView and modify it to show our custom view as default.
function handleView(o, entity){
var selObjectsDropdown = (typeof (selObjectsList) == Mscrm.TypeNames.undefinedType) ? selObjects : selObjectsList;
if (o.innerHTML.indexOf(‘Case Member View’)!=-1){
var sOriginalViewId = “{C0F1DD64-1BF3-450D-BCDE-DF4732DE1001}”;
}
else {
var sOriginalViewId = crmGrid.GetParameter(“viewid”);
if (selObjectsDropdown.selectedIndex != -1 && selObjectsDropdown.options.length > 0) {
var tempDefaultViewId = selObjectsDropdown.options[selObjectsDropdown.selectedIndex].guid;
if (!IsNull(tempDefaultViewId)) {
sOriginalViewId = tempDefaultViewId;}}}
. . . . . . . .
. . .
It is an unsupported customization!!!!
Bye..
Discover more from Nishant Rana's Weblog
Subscribe to get the latest posts sent to your email.

Could they do it more difficult…
LikeLike
My selObjectsDropdown is getting “undefined” so in my further code it not match with entity id which is “2”. that’s why filtering is not happening.
LikeLike