4

Is there any way to call the MS CRM web service from JavaScript from a web page that is NOT a CRM web page (i.e., not in the load or save event in a CRM form, but from a stand alone web page)? A second question: is there any way to call the MS CRM Web Service from VBScript?

Ideally I'd like to do this in CRM 2011, but would be happy to have an example from CRM 4.0.

I'm thinking I'm going to have to write a wrapper web service to do this but I would rather not go that route unless necessary.

Matt
  • 4,656
  • 1
  • 22
  • 32
Jeff
  • 611
  • 5
  • 21

3 Answers3

2

In CRM 2011 there is an OData interface. OData is a RESTful endpoint and can be called from any client capable of making a web request. CRUD (Create, Read, Update, Delete) operations are supported for all CRM entities. It also can format output as JSON which is perfect for use in client side JavaScript. Here's a link to the SDK where you can find more information about OData in CRM 2011

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0c7dcc45-9d41-4e2e-8126-895517b4274c

For CRM 4 the options are limited but there is at least one Javascript framework that I know of: http://danielcai.blogspot.com/2010/01/crm-web-service-javascript-toolkit.html

Clint Simon
  • 971
  • 1
  • 6
  • 9
  • Thanks, TechHike. Funny that you posted this - I've spent a bit of time last week looking at CRM 2011 including oData and plan to write a blog entry on it since I have one due this week. I wasn't sure how for what I needed to do how practical oData would be since I'd want to get everything out of a database using it. The ultimate goal, which I probably should have stated, is to actually export data from CRM Online, including foreign keys (i.e. the accountid on the contact record) for use outside CRM. – Jeff Feb 24 '11 at 18:11
  • I think OData would be good for this purpose. I haven't used it much but it seems pretty nifty. – Clint Simon Feb 25 '11 at 20:12
  • Wow, i didn't know CRM 2011 has OData built in. That made me smile:) – Radu Caprescu Feb 25 '11 at 20:17
2

From my reading and experimentation, it is not possible to call the oData endpoint from an external application that is not hosted within Dynamics CRM.

Using the OData endpoint in Visual Studio The OData service in Dynamics CRM does not permit authentication from external applications. (An exception to this is if the external application uses the Azure AppFabric Service Bus to pass messages between it and Dynamics CRM’s OData service.) However, a Web resource such as a Silverlight XAP file or a JavaScript file that is hosted in a Dynamics CRM solution can use the OData service as a data source.

See http://my.safaribooksonline.com/book/-/9780470568149/chapter-22-working-with-server-side-customizations/585

My understanding is that WCF is the way to go for external applications.

ccellar
  • 10,326
  • 2
  • 38
  • 56
Brian
  • 36
  • 2
1

Just to update the answer, it does like you can call the OData Endpoint from an external resource now (CRM 2013). http://msdn.microsoft.com/en-us/library/dn531009.aspx

Brandon Tull
  • 337
  • 4
  • 17