Building an editable grid for CRM 2011

This is a common question lately.  First, I strongly recommend you consider purchasing an addon that does this for you.  Build vs. buy is always touchy because sometimes it is easier just to write it than to get approval to purchase an addon.  However, building an editable grid can be time consuming, depending on the complexity of your scenario and how reusable you want your code.  Furthermore, most people will go the “bang it out” vs. “build a robust reusable solution” approach which typically means repetitive coding the next time you want an editable grid somewhere else in your CRM UI.  We all know how that story goes…you were under the gun to get it built so you have copy/paste code everywhere.  In the end, it is probably more cost effective to buy an addon.  Here are the ones I know about:

If these options don’t work for you because you are forced to build instead of buy, then it starts off by understanding the CRM Web Services: 

Use Web Service Data in Web Resources (REST and SOAP Endpoint) (fundamentals and when to use what)

You will need to review both subsections as well:

Use the REST Endpoint for Web Resources

Use the SOAP Endpoint for Web Resources

You need to understand both. Depending on a number of factors, you may use more of one vs. the other but will usually use some combination of both. For the SOAP service, I find the Silverlight CRM SOAP Library very useful. 

From there, you need to decide if you are going to build your editable grid using Silverlight or HTML/JavaScript.  I know there’s all sorts of conjecture about the future of Silverlight, but I’m still of the opinion that Silverlight allows you to build richer web UIs faster than HTML/JavaScript.  If you have a “no plugin” philosophy, then use HTML/JavaScript.  If you believe Silverlight is your fastest route to building the UI customization and you can afford the dependency on a browser plugin…there’s a sensible argument to use it.   I’m not getting in an argument about which one to use.  You decideSmile.  Both of the subsections have examples for Silverlight and HTML/JavaScript.  Within the REST subsection there is a “Contact Editor” sample that brings together some of the core concepts explained in the SDK.  Finally, the following article explains some of the missing pieces around OptionSets, building metadata driven UI, etc. 

Using Option Set Options with the REST Endpoint – JScript (Microsoft Dynamics CRM 2011)

While the article above only covers the JavaScript scenario, the concepts can be applied to Silverlight as well.  I am not aware of a Silverlight version of the article. 

Once you have been through all of this, you have the fundamentals necessary to build an editable grid.

Note that I didn’t focus on the UI pieces.  That’s because there are a multitude of articles out there on building Grid UIs with Silverlight or HTML/JavaScript.  The “Contact Editor” has a very basic UI.  You will most likely want to jazz it up a bit.

UPDATE (12/31/2011): Some folks have asked me about how I would go about building the UI.  Using Silverlight for this seems like overkill so I’d choose to go the JavaScript route.  I’m a big fan of Knockout JS.  Have a look at the tutorials and examples.  There’s an Editable grid sample.  At the end of going through all the resources above, I’d probably combine my what I’ve learned into a Knockout JS based implementation.  I’ve added it to my TODO list of blog posts/samples.  Now I just have to find the time to build it.


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 )

Facebook photo

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

Connecting to %s