CRM 2011, OData and datajs

UPDATE: FALSE ALARM about batch updates.  Turns out the CRM 2011 OData service doesn’t support batch updatesSad smile.  I just assumed it did because I’ve written .NET/Silverlight clients against the CRM 2011 OData service using a derived DataServiceContext.  DataServiceContext based contexts using the “unit of work” pattern through SaveChanges()/BeginSaveChangesc() and they’ve always “just worked.”  I just confirmed that Batch isn’t the default SaveChangesOption so all this was predicated on a bad assumption on my partSad smile.  Nothing to see here.

What people often call the CRM 2011 REST Service or Organization Data Service is an OData service.  If you go to the libraries section of the OData site and select JavaScript, you will be linked to the datajs CodePlex site.  So what about the CRM SDK OData samples (SDK.REST.js and SDK.JQuery.js)?  It’s probably one of those “six in one hand, half dozen in the other” situations in terms of the shared capabilities of the libraries.  Which API you like better probably boils down to a style preference.  There are some differences in capabilities as well.  The CRM SDK libraries have explicit functions to associate / disassociate records.  One of the things the CRM SDK sample libraries don’t offer is a facility to do batch updates, but datajs does.  This comes in really handy when you want to do a bunch of work client side to some data and send it all at once.  Have a look at the OData Code Snippets.  They also have a full OData API reference.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s