SOAP Fetch using wrong organization

Mar 27, 2014 at 8:45 PM
I have a development server with 2 organizations on it. I wrote a small html web resource to display some data but when the fetch runs it is looking at what i believe to be the default org not the one I'm currently running in.
I have to believe that there is a way to get and set the org for the toolkit

Here is my code

var sFetchXml = "<fetch mapping='logical' count='50' version='1.0'><entity name='esi_waivedcost'><attribute name='esi_cost' /><attribute name='esi_name' /> <filter><condition attribute='esi_inventoryid' operator='eq' value='" + inventoryId + "' /></filter></entity></fetch>";
        var poFetchResult = XrmServiceToolkit.Soap.Fetch(sFetchXml); 
Mar 28, 2014 at 11:21 AM

Web Resource works only on the organisation where you put the web resource. Please have a look at the CRM SDK to work out how the organisation and authentication information are passed to a web resource.

You cannot pass organisation and authentication information using JavaScript.

Mar 28, 2014 at 9:38 PM
My scenario is the HTML with this code in it is loaded into OrgA as a webresource. When I load the page and irame I get the data from OrgB which was the first organization I set up therefore the default.

I need to have the html use the data for the currently loaded organization not the default. I have proven the fact that it looks at the wrong org on load so I'm not sure if this fixable or not.

I'm not sure why Microsoft thinks that if I'm running a web resource in an organization that I would want it to retrieve data from another.