locked
Custom View not executing on change of another Lookup valuesin MSCRM 2011 RRS feed

  • Question

  • I tried adding Custom View for custom entities . It worked fine on page load . But when i changed one of the lookup then other dependent lookup didn't populate  values as expecte . I used  below url

    http://msdn.microsoft.com/en-us/library/gg334266.aspx#BKMK_addCustomView

    i am getting ajax onreadystate = = 4  when page loads  for the Custom view . But when i change one lookup then ajax onreadystate is 1 or 3. I don't now why i am not able to get onreadtstate == 4 for lookup change .


    Abhishek

    • Changed type Abhisinha17 Wednesday, March 21, 2012 12:05 PM
    Wednesday, March 21, 2012 12:03 PM

Answers

  • Hi,

    You can use following javascript to add  Custom View to lookup Control.

    AddCustomViewToLookupControl("lookupControlname", null, "entityName", "Custom Filtered Lookup", fetchXml, layoutXml);

     function AddCustomViewToLookupControl(lookupControlname, viewId, entityName, viewDisplayName, fetchXml, layoutXml) 
     {


        if (lookupControlname != null && Xrm.Page.getControl(lookupControlname) != null) {
            var lookupControl = Xrm.Page.getControl(lookupControlname);
            viewId = viewId != null ? viewId : "{C7034F4F-6F92-4DD7-BD9D-9B9C1E996381}";
            viewDisplayName = viewDisplayName != null ? viewDisplayName : "Custom View";
            lookupControl.addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, true);
        }
    }

    Hope it helps,

    Regards,

    Yusuf


    Monday, April 2, 2012 11:49 AM