Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Fetch XML in Javascript error

$
0
0

I'm using FetchUtil to retrieve CRM data from javascript and I keep getting the following error:

<code>0x80040203</code>
<description>Url does not contain MSCRMServices or XRMServices</description>

I am running the following code on form load:

function getTaxRate() {
    var teamId = Xrm.Page.getAttribute("ownerid").getValue()[0].id;

    teamId = teamId.replace("{", "").replace("}", "");

    var _oService;
    var _sOrgName = "myorg";
    var _sServerUrl = Xrm.Page.context.getServerUrl();

    var fetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +"<entity name='team'>" +"<attribute name='name'/>" +"<filter type='and'>" +"<condition attribute='name' operator='eq' value='My Team' />" +"</filter>" +"<link-entity name='businessunit' from='businessunitid' to='businessunitid' visible='false' link-type='outer'>" +"<attribute name='new_MyAttribute'/>" +"</link-entity>" +"</entity>" +"</fetch>";

    _oService = new FetchUtil(_sOrgName, _sServerUrl);
    _oService.Fetch(fetchXml, myCallBack);

}


function myCallBack(results) {
    alert(results[0].attributes["new_MyAttribute"].value);
}

The alert pops up a huge error with the code/description mentioned above. I've verified _sOrgName and _sServerUrl are correct.

I've tested the fetch xml in Stunnware and it worked perfectly.

What could be going on here?

Thanks



Viewing all articles
Browse latest Browse all 8223

Trending Articles