locked
Accessing the CRM lookup window from an external application RRS feed

  • Question

  • I have some nice JavaScript code that allows you to access the lookupinfo.aspx page when deploying a solution as an html web resource.  

    var surl = "http://mycrmtest.crm.dynamics.com/_controls/lookup/lookupinfo.aspx?AllowFilterOff=1&DefaultType=2&DefaultViewId=%7bA2D479C5-53E3-4C69-ADDD-802327E67A0D%7d&DisableQuickFind=0&DisableViewPicker=0&LookupStyle=single&ShowNewButton=1&ShowPropButton=1&browse=0&objecttypes=2";
    var oLookupItems = window.showModalDialog(surl, window, "dialogwidth: 450; dialogheight: 300; resizable: yes");
                if (oLookupItems != null) {
                    if (oLookupItems.items.length > 0) {
                        var name = oLookupItems.items[0].name;
                        alert('name: ' + name);
                        document.getElementById('new_actionby').textContent = name;
                        var Id = oLookupItems.items[0].id;
                        Id = Id.replace("{", "");
                        Id = Id.replace("}", "");
                        alert('Id: ' + Id);
                    }
    

    I ran into a problem using this code when attempting to access it from an external .aspx page.  
    The first issue I noticed was the inability to script across domains.  I found a solution that utilizes a local proxy:  http://www.sharepointjohn.com/aspnet-proxy-page-cross-domain-requests-from-ajax-and-javascript/
    This solution works great when authentication is NOT involved, but does not work when authenticating to onPremise or online.  I even tried wrapping the proxy code in my OrganizationServiceProxy authentication, but that does not work.
    Is there a way to authenticate to CRM when passing code via a proxy?
    Is there a way to  legally script across domains?
    Is there a better way to access the lookupinfo.aspx page when hosted on another domain?

    Thank you for reading.

    Thursday, September 5, 2013 5:05 PM