Adding Record Creation Buttons to the CRM 2011 Ribbon

I was recently asked how to move the Create New Case button from the Case ribbon to the Queue ribbon.   I was initially sceptical of this being possible, but after a little investigation found that in a roundabout way it is.

In this post I will demonstrate this approach but with a more widely applicable scenario – I will add a collection of quick create buttons to the Dashboard ribbon.  And I’ll demonstrate the process using the awesome new Visual Ribbon Editor from Erik Pool (thanks mate, you are a rock star!).

Here’s what we want to end up with:

image


Ok, so first thing to do is download the Visual Ribbon Editor from here.  The tool doesn’t need to be ‘installed’ as such.  I like to place the unzipped files on to my C drive and then create a desktop shortcut to the exe.   Launch the app and connect to your CRM instance using the first button on the menu:

image

And then click the 2nd button on the menu, and open the Case entity’s Ribbon definitions:

image 

By default the Case entity’s Form ribbon is displayed to you initially.  I want to look at the definition of the New button and that exists on the ribbon that displays above the Case view so from the menu change the Ribbon Type dropdown to Homepage:

image

Erik’s tool will now display a simulated version of the Case’s HomePageGrid ribbon (so cool!).  Click on the New button and you will see the definition of that button appear below:

image

Now, I want to recreate this button so initially I thought I would note the images defined here for the button and set my new button to use those.  But, the image used is the same for all entities so I would end up with a pretty dull looking ribbon if I did this:

image

So, instead I will find the individual entity images CRM uses and use those.  I will come back to that later.

Here, looking at the Case ribbon definition we want to determine the jscript function called by the button.  Click on the Action tab and then click the small arrows to expand what is displayed:

image

I originally thought I would see the button calling a CreateNewCase function.  Instead you will see Microsoft have designed a generic function that the new button on each entity can call passing in a unique entity identifier parameter to control which entity form is popped.

To replicate these buttons on the Dashboard ribbon we can call the same function and explicitly specify the entity identifier.  We are heading into unsupported territory here and there is a risk this solution won’t work after an upgrade but it’s an easy change to undo and if you needed to find an alternative approach in the future it wouldn’t be hard, this way is just the quickest.

Ok, now that we know what to do we need to switch to the Dashboard ribbon.  Click the Open button again and select Application Ribbons:

image

The Dashboard ribbon is then displayed by default:

image

So we can start making our edits.  Click the Create New Group button and then assign a unique ID to the new Group:

image

Click on the Title of the new group that appears on the simulated ribbon and then click the New Button button:

image

Give your new button a unique ID:

image

And then repeat to add additional buttons for each CRM record type you want to support.  By default the button group will be displaying your buttons as small buttons stacked vertically.  This is a bit ugly and we have plenty of space on the ribbon so select the button group and then change the Template to one that displays the buttons as large buttons:

image

And you should end up with a nice list of buttons:

image

Next step is to add the jscript call to each button.  For this we need to know the unique identifier of each entity.  For this, I downloaded and installed the MetaData Browser from here.  This is provided as a managed CRM solution so you import the file you download into CRM and then access the tool from within CRM.  With this tool you can easily search for your entities and locate their unique identifiers:

image

Ok, back to the Ribbon editor.  Click on the Case button and then select the Actions tab and add the following:

image

Repeat for each additional button, entering their unique identifier (Object Type Code from the Meta Data Browser) in as the Integer Parameter value.

Final step is to assign each button an image to pretty things up.  I want to use CRM’s standard images for each entity so I will go looking for those on the CRM Server.   These images can be found in your equivalent of the below folder:

C:\Program Files\Microsoft Dynamics CRM\CRMWeb\_imgs\Ribbon

Microsoft employs a consistent naming convention made up of an “Entity” prefix followed by the image size followed by the unique entity identifier.  So for my 5 entities (1,2,3,112, and 4212) I want the following files:

image

Now, we could grab these files and load them into CRM as web resources and then reference the web resources in our ribbon definitions but easier still is to just reference the files on the server in the same way that the standard ribbon buttons do (although this might need adjusting after an upgrade if Microsoft renames or moves those files).  Here’s what I entered for my new custom Case button:

image

Adding the image references for each of my remaining buttons has me ending up with this:

image

I click Save to update CRM:

image

And can then immediately see my new buttons appearing on the Dashboard ribbon:

image

A quick test, and yes they also work:

image

That’s it.  You could go on and add language translations and display rules for the buttons but I won’t go into that here.  To migrate this customisation to another environment simply include the Application Ribbons component in your Solution file.

If you would like a copy of this customisation I have a solution file available here.

Smile

Advertisements

10 thoughts on “Adding Record Creation Buttons to the CRM 2011 Ribbon

  1. Steve

    Love the tool and the guide, but I had one question: do you know how to save this solution as something other than “Ribbon Editor”? Do I have to export it, rename it by editing the customization files and then re-import it?

    Reply
    1. Gareth Tucker Post author

      Hi, why do you want to rename it? The solution is only there as a temporary transportation mechanism for the Tool to use whilst publishing changes. It should only exist in your development environment. To migrate ribbon changes to another environment you should use your own Solution.

      Reply
      1. Steve

        Right. I’ve been using it only in my dev environment (since the tool won’t even connect to my prod environment) and when I try to export the RibbonEditor from dev and import to Prod it tends to fail, saying it is missing some fields that I know are already in Prod. I get hte sense that I am doing something wrong.

      2. Steve

        I was able to get things working, but I don’t know if it’s the right way: I couldn’t connect to Prod using the Tool, so I created a new solution, called it “CustomQueueRibbon” and added the QueueItem entity to it (since the tool should have already modified it). I then exported it from Dev as an unmanaged solution and imported it into Prod. I tried to export as a managed, but I kept getting warnings about missing fields (even though prod already has them). So I hope that’s the right way to go about things.

  2. Brian

    These tools all work great. Thanks for info. I’m having a little difficulty that you might be able to assist with. I created a new entity called quote requests and related it to the contacts and mapped a few fields. Now when I go to a contact I can create a quote request and it will populate the contact name into the quote request window. Using the details above I was also able to create a ribbon button to create a new quote request from the contact. The only thing is that is doesn’t pass the contact name – it’s just a standard form. Any info on how I can still pass (map) fields using a ribbon button?

    Thanks

    Reply
  3. Brian

    Thanks for the follow up. We were finally able to get everything working as we wanted however we did find a bug that Microsoft acknowledged will be fixed in rollup 8. Thought I would point it out in case anyone else comes across it. When you are using an IFD of an on-premise install with ADFS logins and using the Outlook client the custom ribbon buttons prompt for the ADFS login every time you click them. It isn’t able to pass the authentication like it does when using IE. The tech said she was able to confirm it is fixed in rollup 8. Thanks again for the help. Your blog is great!

    Reply
  4. Peter

    It may be worth using Xrm.Utility.openEntityForm now rather than openObj which will then provide a more supported solution.

    Reply
  5. Adam

    I am looking to create an assign button on the queue entity. Will this allow me to do that? I am trying to select bulk activities (specifically trades) and assign them to an individual, essentially changing the owner, but I want the trade to remain in the trading queue I created. My big deal is creating the assign button on the queue entity. This is the closest thing I have found to being able to do it, short of a custom plugin (not good with C#). So again, is this capable of adding an assign button to that specific ribbon on the queue entity? If you could explain how or provide an example that would be absolutely amazing. Thank you.

    Reply

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s