4
votes

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.

3

3 Answers

2
votes

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.

2
votes

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

1
votes

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