Creating Url String For Call To Organizationdata.svc Using Javascript
Currently, I have two different methods to decide which version of CRM that my JS runs on. The addresses are similar but differ still, depending on whether it's on-line or on-premi
Solution 1:
- I wouldn't use parent.window.location.host (not even sure if it's supported).
- You get organizationName disregarding whether it's on-line version or on-premise (needlessly).
- The call will fail if an on-premise is set up on secured HTTP (or you'll need yet an other flag).
- My suggestion would be to focus on CRM 2011 (the older version 4 uses SOAP, not REST).
- For the actual OrganizationData service you can use the function below (or just embed the line).
function getOrganizationDataService(){
return Xrm.Page.context.getServerUrl()
+ "/XRMServices/2011/OrganizationData.svc";
}
Solution 2:
I would suggest having a look at this sample: Sample: Create, Retrieve, Update and Delete Using the REST Endpoint with JavaScript.
In particular:
sample_/Scripts/SDK.REST.js A reusable, generic library that simplifies asynchronous data operations using the REST Endpoint for Web resources.
In particular the first few functions which effectively build REST OrganizationData endpoint like so (I've cut out a couple of steps here, so make sure to look at the sample code):
Xrm.Page.context.getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
Post a Comment for "Creating Url String For Call To Organizationdata.svc Using Javascript"