Saturday, October 12, 2013

Edit command bar / ribbon in Microsoft Dynamics CRM 2013

As Microsoft Dynamics CRM 2013 came out the ribbon was excluded with couple exceptions. Instead of ribbon we now have something that's called "command bar", well, because it is a command bar. However, you could think it as a "ribbon in disguise" because all modifications are still to be done through RibbonDiffXml. You can modify your RibbonDiffXml by hand or you can make your life much easier and use Ribbon Workbench software / solution. It will allow you to modify both your command bar and the ribbon. Some few entities / forms in Crm 2013 still use ribbons. Outlook client use ribbons in a certain depth as well so it's definitely something to keep in mind. I also recommend to take a look at the CRM 2013 SDK as it can help you to understand this whole concept.

Example

In this example I'm adding a simple button to my custom entity's command bar

RibbonDiffXml:


And here is what it looks like. Notice my custom webresource icon. You can find tons of icons in CRM SDK.




And this is how Ribbon Workbench looks like. I definitely recommend using it but of course it's always good to know what happens under the hood!



Resources:

4 comments:

  1. Hi, I have no experience on that. According to their web site they have some sort of implementation of that in HTML and JavaScript but can't really find out more. Just a wild guess that using it with CRM may be little tricky. But as I said, I have no experience and thus no idea.

    ReplyDelete
  2. Hi Kalle, Great posts.

    Question: how did you customize webresource icon. The font looks like it came from the SDK?

    ReplyDelete
    Replies
    1. Hi, thank you for your comment.

      In order to use your own icon you have to upload it to CRM as a webresource first. Then you refer to it as follows: Image16by16="$webresource:ant_openWikiIcon16"/> (see a code sample above). If I remember correctly I found this icon from SDK folder "SDK\Resources\Images".

      When it comes to a font it is something that CRM renders and as far as I know there is no way (supported way) to change it. Of course you could change it by using javascript hack but I highly not recommend it.

      Hope this answers your question and if not please don't hesitate to ask again.

      Delete