Solution Segmentation for entity ribbons

The new feature for segmenting solutions in Microsoft Dynamics CRM is absolutely awesome.
It finally allows you to only include the parts you actually want your solution to change.

For us as an ISV this is a huge improvement. We can now deliver solutions that are completely “plug and play” and still leave a minimal footprint on the whole customer system.

RibbonDiffXml segmentation

There is however one thing that is still not possible to separate with enough granularity. To include the ribbon definition of an entity, you need to check the Include entity metadata checkbox. image Unfortunately this also includes the entity display name, plural name, and all other “entity wide” settings such as Notes, Connections, Mail merge etc. The result of this is that if we include the Contact entity just to be able to add a solution specific button to the command bar, we must also include the entity settings.

Problem

When a customer has developed their own solutions, or got solutions from other third parties, we quite often face the situation where they have changed the name of an entity, e.g. Contact is renamed to Person. Now importing our solution to add this button to the contact command bar, will also change the name of the contact entity back to default, or rather to whatever it is called in our solution.

Solution

This could be solved by allowing a separate option for the RibbonDiff part of the entity definition when selecting components for the solution.

Vote!

If you agree with this proposal, you can contribute by voting up this item on Microsoft Connect.

Read more

MVP Jukka Niiranen recently wrote an excellent article describing Solution Segmentation in Microsoft Dynamics CRM.

Save & Publish Button for Forms and WebResources

While working with customizations and UI development in CRM 2011 – have you ever been looking for that “Save and Publish” button? Have you ever not been looking for it? We all wonder why it is not there and there is a case on Microsoft Connect requesting it.
But relax, it is quite easy to get it in there right now.

Annoying facts:

SaveAndPublish32It seems to me that someone just forgot to implement this function. There is a button icon /CRMWEB/_imgs/ribbon/SaveAndPublish32.png (and corresponding 16 pix icon). The javascript function being called when clicking the existing Publish button in form customization is called SaveAndPublish(). It just does not do what the name indicates.

Solution:

To get a Save & Publish button:

  • Create a javascript webresource that first calls the Save function and then the Publish function
  • Create the button in the RibbonDiffXml section of customizations.xml, using existing icon files and calling the function created in step 1
  • Import the ribbon customizations SnP
    Javascript:
    Cinteros.Xrm.Customization = {
        SaveAndPublishForm: function () {
            try {
                SaveForm(false);
            }
            catch (e) { }
            try {
                SaveAndPublish();
            }
            catch (e) { }
        },
        SaveAndPublishWebResource: function () {
            try {
                SaveForm(false);
            }
            catch (e) { }
            try {
                PublishWebResource();
            }
            catch (e) { }
        }
    }
    RibbonDiffXml:
      <RibbonDiffXml>
        <CustomActions>
          <CustomAction Id="Cint.Mscrm.FormEditorTab.SaveButtons.Controls" Location="Mscrm.FormEditorTab.SaveButtons.Controls._children" Sequence="1">
            <CommandUIDefinition>
              <Button Command="Cint.Mscrm.FormEditorTab.SaveButtons.Controls.Button.SaveAndPublish" CommandType="General" Id="Cint.Mscrm.FormEditorTab.SaveButtons.Controls.Button.SaveAndPublish.Id" Image16by16="/_imgs/ribbon/SaveAndPublish16.png" Image32by32="/_imgs/ribbon/SaveAndPublish32.png" TemplateAlias="o1" LabelText="$LocLabels:Cint.Mscrm.FormEditorTab.SaveAndPublish.LabelText" ToolTipTitle="$LocLabels:Cint.Mscrm.FormEditorTab.SaveAndPublish.ToolTip" ToolTipDescription="$LocLabels:Cint.Mscrm.FormEditorTab.SaveAndPublish.ToolTipDescription" />
            </CommandUIDefinition>
          </CustomAction>
          <CustomAction Id="Cint.Mscrm.WebResourceEditTab.Save.Controls" Location="Mscrm.WebResourceEditTab.Save.Controls._children" Sequence="1">
            <CommandUIDefinition>
              <Button Command="Cint.Mscrm.WebResourceEditTab.Save.Controls.Button.SaveAndPublish" CommandType="General" Id="Cint.Mscrm.WebResourceEditTab.Save.Controls.Button.SaveAndPublish.Id" Image16by16="/_imgs/ribbon/SaveAndPublish16.png" Image32by32="/_imgs/ribbon/SaveAndPublish32.png" TemplateAlias="o1" LabelText="$LocLabels:Cint.Mscrm.FormEditorTab.SaveAndPublish.LabelText" ToolTipTitle="$LocLabels:Cint.Mscrm.FormEditorTab.SaveAndPublish.ToolTip" ToolTipDescription="$LocLabels:Cint.Mscrm.FormEditorTab.SaveAndPublish.ToolTipDescription" />
            </CommandUIDefinition>
          </CustomAction>
        </CustomActions>
        <Templates>
          <RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
        </Templates>
        <CommandDefinitions>
          <CommandDefinition Id="Cint.Mscrm.FormEditorTab.SaveButtons.Controls.Button.SaveAndPublish">
            <EnableRules>
              <EnableRule Id="Mscrm.Enable.IsCustomizableManagedPropertyRule" />
            </EnableRules>
            <DisplayRules />
            <Actions>
              <JavaScriptFunction FunctionName="Cinteros.Xrm.Customization.SaveAndPublish" Library="$webresource:cint_/scripts/utils_support.js" />
            </Actions>
          </CommandDefinition>
          <CommandDefinition Id="Cint.Mscrm.WebResourceEditTab.Save.Controls.Button.SaveAndPublish">
            <EnableRules>
              <EnableRule Id="Mscrm.Enable.IsWebResourceCustomizableRule" />
            </EnableRules>
            <DisplayRules />
            <Actions>
              <JavaScriptFunction FunctionName="Cinteros.Xrm.Customization.SaveAndPublishWebResource" Library="$webresource:cint_/scripts/utils_support.js" />
            </Actions>
          </CommandDefinition>
        </CommandDefinitions>
        <RuleDefinitions>
          <TabDisplayRules />
          <DisplayRules />
          <EnableRules />
        </RuleDefinitions>
        <LocLabels>
          <LocLabel Id="Cint.Mscrm.FormEditorTab.SaveAndPublish.LabelText">
            <Titles>
              <Title languagecode="1033" description="Save and Publish" />
              <Title languagecode="1053" description="Spara och Publicera" />
            </Titles>
          </LocLabel>
          <LocLabel Id="Cint.Mscrm.FormEditorTab.SaveAndPublish.ToolTip">
            <Titles>
              <Title languagecode="1033" description="Save and Publish" />
              <Title languagecode="1053" description="Spara och Publicera" />
            </Titles>
          </LocLabel>
          <LocLabel Id="Cint.Mscrm.FormEditorTab.SaveAndPublish.ToolTipDescription">
            <Titles>
              <Title languagecode="1033" description="Saves and publishes the form" />
              <Title languagecode="1053" description="Sparar och publicerar formuläret" />
            </Titles>
          </LocLabel>
        </LocLabels>
      </RibbonDiffXml>
    

    Shortcut:

    If you don’t want to do this manually, you can download a solution with just this content HERE.