Monday, January 18, 2016

CRM REST Builder Now with Web API

It’s been long overdue for an update and with the recent release of CRM 2016 and the new Web API endpoint it seemed like the perfect time.
For those that might have used the tool before here’s the important info:

New and Changed
  • Web API Support (2016+)
    • Create, Retrieve, Retrieve Multiple, Update, Delete, Associate, Disassociate, & Execute Predefined Queries by Id and using FetchXML
    • Support for formatted values, impersonation, change detection, & count
    • XMLHTTP & jQuery
  • 2011 Enhancements
    • Fixed a lot of bugs, so many bugs
    • Corrected handling of self-referencing N:N relationships
  • General
    • Supporting library updates
    • Removed entities and attributes that weren’t supported be either endpoint
    • 1 click select & copy
    • Better escaping of special characters
    • Generate code to loop through results of included relationships
    • Lots of usability enhancements
Known Issues
  • Web API – Using RetrieveMultiple, any operation that requires expand (select or filter) isn’t supported by the endpoint yet and hasn’t been exposed in the tool. If you need this you’ll need to use the 2011 endpoint. I’m assured it’s coming at a later date by my friends at Microsoft. When using Retrieve, expand works as expected.
  • Web API – Attempting to use RetrieveMultiple and filter on a Date field that is designated as Date Only will fail with a 400 Bad Request error. I’ve been informed this is actually a bug with endpoint. The code being generated should be correct so I left this in hoping Microsoft would sneak a fix in before the next major update.
  • Web API – Using Retrieve, the endpoint doesn’t support using the expand operation using self-referencing N:N relationship so they aren’t displayed. Web API Limitations
  • Web API – Using Associate/Disassociate, again self-referencing N:N relationships are supported yet so they aren’t displayed.

If you aren’t familiar with the tool it’s essentially a code generator that creates JavaScript to perform actions against CRM’s REST endpoints. It installs as a managed solution into your organization so you’ll get the benefit of working with the entities and attributes that you’ve created. Point and click to specify the parameters and it spits out the code.

Even if you aren’t into coding, the tool can still be valuable if you’re looking to get information out of CRM that you wouldn’t normally be able to see very easily. There are quite a few entities in CRM that aren’t exposed through the UI or via advanced find but can be accessed through the web service calls this tool can perform. So if you need to query (or even create, update, or delete!) data about workflows, solutions, forms, views, etc. you can do that also because the tool has the ability to execute the code it creates and display any results.

Here’s a quick example. You need JavaScript code against the Web API endpoint to query for a list of accounts whose name starts with the letter “L”.
First define the options for endpoint, type of request, the entity to query against, the fields to return, the filter criteria, and any other options.


Hit the Create Request button and review the code that was generated. Copy the output to a web resource and use it CRM.


If you want to see the results, use the Execute Code button.


Get it on CodePlex:

2011 & 2013

2015 & 2016