Working with Display Rules in CRM 2011–Ribbon Customisation

In this post I provide a quick guide on how to apply Display Rules to your custom ribbon buttons in Microsoft CRM 2011.

Firstly, here’s a quick run through on how to apply a Display Rule.

I have added a custom button to the Campaign form’s ribbon, as per below:

image

To add a display rule to limit when the button should appear I need to do 2 things:

1. Define the Display Rule

2. Assign the Display Rule to the button

To define the Display Rule we need to add the following to our customization.xml file:

image

This can be read as: 

“I want to define a new display rule called "GT.campaign.Form.Star.FormStateNotCreate.DisplayRule".  The rule is the button should only show if the form is not the Create form”.

And then to assign this rule to our button we simply reference the above ID in the Command Definition of our button:

image

Here’s a few more common Display Rule examples:

Display only on Create form:

            <DisplayRule Id="GT.campaign.Form.Star.FormStateCreate.DisplayRule">
              <FormStateRule State="Create" />
            </DisplayRule>

Display only on Update or Create form:

            <DisplayRule Id="GT.campaign.Form.Star.FormStateCreateOrUpdate.DisplayRule">
              <OrRule>
                <Or>
                  <FormStateRule State="Existing"/>
                </Or>
                <Or>
                  <FormStateRule State="Create"/>
                </Or>       
              </OrRule>
            </DisplayRule>

Do NOT display when Offline:

            <DisplayRule Id="GT.campaign.Form.Star.IsOffLine.DisplayRule">
            <CrmOfflineAccessStateRule
               Default="true"
               State="Online"  />
            </DisplayRule> 
Advertisements

3 thoughts on “Working with Display Rules in CRM 2011–Ribbon Customisation

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