MS CRM 2011 – Hiding a Group of Ribbon on Specific State

Today I come up with another task to only show the button on a group only when the record has already been saved.
After some times reading at the CRM 2011 SDK documentation and some time searching for clue, I found a solution.
Desired Result
desired result2
The above pictures are the desired result. The button should be shown after the record has been saved.

So the changes to the Ribbon XML can be like this:

	  <CustomAction Id="Mscrm.ISV.campaignresponse.CustomGroup.MaxSize.CustomAction" Location="Mscrm.Form.campaignresponse.MainTab.Scaling._children" Sequence="150">
		  <MaxSize Id="Mscrm.ISV.campaignresponse.CustomGroup.MaxSize" GroupId="Mscrm.ISV.campaignresponse.CustomGroup.Interaction" Sequence="21" Size="LargeLarge" />
	  <CustomAction Id="Mscrm.ISV.campaignresponse.CustomGroup.CustomAction" Location="Mscrm.Form.campaignresponse.MainTab.Groups._children" Sequence="115">
		  <Group Id="Mscrm.ISV.campaignresponse.CustomGroup.Interaction" Command="Mscrm.Enabled" Title="Interaction" Sequence="85" Template="Mscrm.Templates.3.3" >
			<Controls Id="Mscrm.ISV.campaignresponse.CustomGroup.Controls">
			  <Button Id="Mscrm.ISV.campaignresponse.Form.Interaction.Button.AddGuest"
							ToolTipDescription="Add Guest"
							LabelText="Add Guest"
							Alt="Add Guest"
							TemplateAlias="o1" />
	  <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
		  <CommandDefinition Id="Mscrm.ISV.campaignresponse.Form.Interaction.Command.AddGuest">
		  <DisplayRule Id="Mscrm.ISV.campaignresponse.CustomGroup.Interaction" />
			  <Url Address="$webresource:pages/addGuests" PassParams="true"/>
	  <TabDisplayRules />
		<DisplayRule Id="Mscrm.ISV.campaignresponse.CustomGroup.Interaction">
		  <FormStateRule State="Create" InvertResult="true" /> <!-- THIS IS THE TRICK -->
	  <EnableRules />
	<LocLabels />

One thought on “MS CRM 2011 – Hiding a Group of Ribbon on Specific State

  1. I do love the way you have presented this specific situation and it does indeed supply us some fodder for consideration. On the other hand, because of just what I have observed, I just wish as the feed-back stack on that people continue to be on issue and not get started upon a tirade associated with the news of the day. Anyway, thank you for this superb piece and even though I do not concur with it in totality, I value your point of view.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

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

Connecting to %s