Adding a button to account entity homepage's ribbon/command bar - dynamics-crm

Playing with the ribbon, I tried to add a button over the account entity homepage's ribbon/command bar, just before the +New button. But it is not showing anywhere over the page. What am I missing?
This is the sample XML I've coded after reading the SDK.
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="Bee.CustomAction.GoToUrl" Location="Mscrm.HomepageGrid.account.MainTab.Management.Controls._children">
<CommandUIDefinition>
<Button Id="Bee.HomepageGrid.account.GoToUrl" Command="Bee.CommandDefinition.GoToUrl" LabelText="Go To URL" ToolTipDescription="Description, Go to URL with selected account" ToolTipTitle="Title, Go to URL with selected account" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
<CommandDefinition Id="Bee.CommandDefinition.GoToUrl">
<EnableRules>
<EnableRule Id="Bee.EnableRule.SelectionCountOne" />
</EnableRules>
<DisplayRules>
<DisplayRule Id="Bee.DisplayRule.AllClients"/>
</DisplayRules>
<Actions>
<Url Address="http://localhost/mysite" PassParams="true"></Url>
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
<DisplayRule Id="Bee.DisplayRule.AllClients">
<CommandClientTypeRule Type="Modern" />
<CommandClientTypeRule Type="Refresh" />
<CommandClientTypeRule Type="Legacy" />
</DisplayRule>
</DisplayRules>
<EnableRules>
<EnableRule Id="Bee.EnableRule.SelectionCountOne">
<SelectionCountRule Minimum="1" Maximum="1" AppliesTo="SelectedEntity" />
</EnableRule>
</EnableRules>
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>

I just apply one CommandClientTypeRule Type="Refresh", it works. Again apply all three types not working. All have different meanings as below.
Modern: The command bar is presented using Microsoft Dynamics CRM for tablets.
Refresh: The command bar is presented using the updated user interface.
Legacy: The ribbon is presented in forms for entities that were not updated or in a list view in Microsoft Dynamics CRM for Microsoft Office Outlook.
<DisplayRules>
<DisplayRule Id="Bee.DisplayRule.AllClients">
<CommandClientTypeRule Type="Refresh" />
</DisplayRule>
</DisplayRules>
But Go to url button goes to overflow section means in the drop down hidden menu.
Displaying the button on command bar before NEW button apply some sequence, following is RibbonXml that show the button just before NEW button, when one record is selected.
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="Bee.CustomAction.GoToUrl" Location="Mscrm.HomepageGrid.account.MainTab.Management.Controls._children" Sequence="5">
<CommandUIDefinition>
<Button Id="Bee.HomepageGrid.account.GoToUrl"
LabelText="Go To URL"
ToolTipDescription="Description, Go to URL with selected account"
ToolTipTitle="Title, Go to URL with selected account"
Alt="Go to"
Command="Bee.CommandDefinition.GoToUrl"
Sequence="5"
TemplateAlias="o1" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
<CommandDefinition Id="Bee.CommandDefinition.GoToUrl">
<EnableRules>
<EnableRule Id="Bee.EnableRule.SelectionCountOne" />
</EnableRules>
<DisplayRules>
<DisplayRule Id="Bee.DisplayRule.AllClients"/>
</DisplayRules>
<Actions>
<Url Address="http://localhost/mysite" PassParams="true"></Url>
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
<DisplayRule Id="Bee.DisplayRule.AllClients">
<CommandClientTypeRule Type="Refresh" />
</DisplayRule>
</DisplayRules>
<EnableRules>
<EnableRule Id="Bee.EnableRule.SelectionCountOne">
<SelectionCountRule Minimum="1" Maximum="1" AppliesTo="SelectedEntity" />
</EnableRule>
</EnableRules>
</RuleDefinitions>
<LocLabels/>
</RibbonDiffXml>

I would suggest you to try Ribbon Workbench. You don't need to download/extract/modify/pack/import anymore. Everything is done directly from Dynamics CRM and without any knowledge of XML.

You should add LocLabels to your RibbonDiffXml. Attribute LabelText a.o. must hold references to these localized labels. They are not meant to hold the texts themselves.
Look on CodePlex for some fine ribbon editors; they will give you a good start!

Related

CRM solution import failed "an item with the same key has already been added"

I have a strange behaviour in one of our CRM-Organizations.
When I export a solution (which only contains the account-entity) as an unmanaged solution it works.
But when I reimport this very same solution without changing anything I get this error
"an item with the same key has already been added".
I found out that I have to remove the Attribute "ownerid" from the solution (and one relationship) and then it works...
this is the attribute
<attribute PhysicalName="OwnerId">
<Type>owner</Type>
<Name>ownerid</Name>
<LogicalName>ownerid</LogicalName>
<RequiredLevel>systemrequired</RequiredLevel>
<DisplayMask>ValidForAdvancedFind|ValidForForm|ValidForGrid|RequiredForForm</DisplayMask>
<ImeMode>auto</ImeMode>
<ValidForReadApi>1</ValidForReadApi>
<ValidForCreateApi>1</ValidForCreateApi>
<IsCustomField>0</IsCustomField>
<IsAuditEnabled>1</IsAuditEnabled>
<IsSecured>0</IsSecured>
<IntroducedVersion>5.0.0.0</IntroducedVersion>
<SourceType>0</SourceType>
<LookupStyle>single</LookupStyle>
<LookupTypes>
<LookupType id="00000000-0000-0000-0000-000000000000">8</LookupType>
<LookupType id="00000000-0000-0000-0000-000000000000">9</LookupType>
</LookupTypes>
<displaynames>
<displayname description="Vertriebsverantwortlicher" languagecode="1031" />
<displayname description="Owner" languagecode="1033" />
<displayname description="Właściciel" languagecode="1045" />
</displaynames>
<Descriptions>
<Description description="Geben Sie den Benutzer oder das Team ein, der bzw. das mit der Verwaltung des Datensatzes betraut ist. Dieses Feld wird aktualisiert, wenn der Datensatz einem anderen Benutzer zugewiesen wird." languagecode="1031" />
<Description description="Enter the user or team who is assigned to manage the record. This field is updated every time the record is assigned to a different user." languagecode="1033" />
<Description description="Wprowadź nazwę użytkownika lub zespołu, który zarządza rekordem. To pole jest aktualizowane za każdym razem, gdy rekord zostanie przypisany do innego użytkownika." languagecode="1045" />
</Descriptions>
</attribute>
I also checked the serverlogs and found this:
<importexportxml start="635818108905329459" stop="635818109069971342" progress="22.2222222222222" processed="true">
<solutionManifests>
<solutionManifest languagecode="1031" id="Firma_Transfer" LocalizedName="Firma_Transfer" processed="true">
<UniqueName>Firma_Transfer</UniqueName>
<LocalizedNames>
<LocalizedName description="Firma_Transfer" languagecode="1031" />
</LocalizedNames>
<Descriptions />
<Version>1.0.0</Version>
<Managed>0</Managed>
<Publisher>
<UniqueName>myorg</UniqueName>
<LocalizedNames>
<LocalizedName description="Myorg" languagecode="1031" />
</LocalizedNames>
<Descriptions />
<EMailAddress />
<SupportingWebsiteUrl />
<Addresses>
<Address>
<City />
<Country />
<Line1 />
<Line2 />
<PostalCode />
<StateOrProvince />
<Telephone1 />
</Address>
</Addresses>
</Publisher>
<results />
<result result="success" errorcode="0" errortext="" datetime="13:08:12.07" datetimeticks="635818072920798192" />
</solutionManifest>
</solutionManifests>
<upgradeSolutionPackageInformation>
<upgradeRequired>0</upgradeRequired>
<upgradeValid>1</upgradeValid>
<fileVersion>7.0.1.129</fileVersion>
<currentVersion>7.0.1.129</currentVersion>
<fileSku>OnPremise</fileSku>
<currentSku>OnPremise</currentSku>
</upgradeSolutionPackageInformation>
<entities>
<entity LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="true">
<result result="failure" errorcode="0x80044150" errortext="Ein Element mit dem gleichen Schlüssel wurde bereits hinzugefügt." datetime="13:08:26.96" datetimeticks="635818073069658863" />
</entity>
</entities>
<nodes />
<settings />
<dashboards />
<securityroles />
<workflows />
<templates />
<optionSets />
<ConnectionRoles />
<SolutionPluginAssemblies />
<SdkMessageProcessingSteps />
<ServiceEndpoints />
<webResources />
<reports />
<FieldSecurityProfiles />
<convertrules />
<routingrules />
<Slas />
<languages>
<language>
<result result="success" errorcode="0" errortext="" datetime="13:08:11.07" datetimeticks="635818072910798185" />
</language>
</languages>
<entitySubhandlers>
<savedQuery LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/>
<formXml LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false">
</formXml>
<entityCustomResources LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/>
<entityRibbon LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false"/>
<savedQueryVisualization LocalizedName="Firma" OriginalName="Firma" Description="" id="Account" processed="false">
</savedQueryVisualization>
</entitySubhandlers>
<rootComponents>
<rootComponent processed="false" />
</rootComponents>
<dependencies>
<dependency processed="false" />
</dependencies>
All I found in the internet pointed to an problem with an attribute (missmatching type, ...) but in my case this is the same organization and no transfer from dev to prod or something like that...
We are using CRM 2015 but we had this problem in 2011 already.
Has anybody a solution for this? we don't want to edit the customization.XML everytime before importing a solution...
this is the database-field
[OwnerId] [uniqueidentifier] NOT NULL CONSTRAINT [DF_AccountBase_OwnerId] DEFAULT ('00000000-0000-0000-0000-000000000000')
thanks
Tobias
Your database field for OwnerId looks fine. Delete any custom fields with common names from your destination organization and try the import again. For instance, if you have new_LastEmailDate on both, or any custom field that performs the same function as a custom field in the solution, delete it from the destination. One of your custom fields is being recognized as a new addition of an existing field, probably due to capitalization. If you're writing it in from the new solution, you don't need it in the destination anyway and a non-conflicting copy will be replaced.
This happens for me when I try to reinstall a CRM 2016 Outlook that has been offline with a previous version of CRM. Uninstalling CRM and SQL server related items, cleaning up the registry deleting all folder and files related to the installation. I think it's worth mentioning that the installations works against the same CRM environment on other PC's.
The error you are seeing is very generic, but the fact that you know which attribute is causing the issue makes things a lot easier. It is usually possible to fix this type of issue by making direct database changes to repair corrupted metadata (unsupported!), but it requires a SQL developer with decent knowledge of how the CRM metadata tables work. If you have such a person I could provide additional guidance, otherwise you should create a case with Microsoft.

Change the "New" button Quote subgrid

The opportunity form as a quotes sub-grid. I am trying to hide the existing "New" button and create a custom one. Hiding the existing button works like a charm. However, nothing I do seems to make the custom button appear.
I have tried making the enable and visibility conditions as simple as just checking that the form is for an existing entity. Nothing seems to work.
Here's the XML for the quote. Generated using Ribbon Workbench:
<RibbonDiffXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CustomActions>
<CustomAction Id="ntcp.quote.Button1.Button.CustomAction" Location="Mscrm.SubGrid.quote.MainTab.Management.Controls._children" Sequence="17">
<CommandUIDefinition>
<Button Alt="$LocLabels:ntcp.quote.Button1.Button.Alt" Command="ntcp.quote.Command0.Command" Description="" Id="ntcp.quote.Button1.Button" Image32by32="/_imgs/ribbon/newrecord32.png" Image16by16="/_imgs/ribbon/New_16.png" LabelText="$LocLabels:ntcp.quote.Button1.Button.LabelText" Sequence="17" TemplateAlias="o1" ToolTipTitle="$LocLabels:ntcp.quote.Button1.Button.ToolTipTitle" ToolTipDescription="$LocLabels:ntcp.quote.Button1.Button.ToolTipDescription" ModernImage="New" />
</CommandUIDefinition>
</CustomAction>
<HideCustomAction HideActionId="ntcp.Mscrm.SubGrid.quote.AddNewStandard.Hide" Location="Mscrm.SubGrid.quote.AddNewStandard" />
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates" />
</Templates>
<CommandDefinitions>
<CommandDefinition Id="ntcp.quote.Command0.Command">
<EnableRules>
<EnableRule Id="ntcp.quote.EnableRule0.EnableRule" />
</EnableRules>
<DisplayRules>
<DisplayRule Id="ntcp.quote.DisplayRule0.DisplayRule" />
</DisplayRules>
<Actions>
<JavaScriptFunction FunctionName="ntcp_QuoteFromOpportunity" Library="$webresource:ntcp_/quoteFromOpportunity.js" />
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
<DisplayRule Id="ntcp.quote.DisplayRule0.DisplayRule">
<FormStateRule State="Existing" Default="true" />
</DisplayRule>
</DisplayRules>
<EnableRules>
<EnableRule Id="ntcp.quote.EnableRule0.EnableRule">
<FormStateRule State="Existing" Default="true" />
</EnableRule>
</EnableRules>
</RuleDefinitions>
<LocLabels>
<LocLabel Id="ntcp.quote.Button1.Button.LabelText">
<Titles>
<Title description="Add New Quote" languagecode="1033" />
</Titles>
</LocLabel>
<LocLabel Id="ntcp.quote.Button1.Button.ToolTipTitle">
<Titles>
<Title description="Add New Quote" languagecode="1033" />
</Titles>
</LocLabel>
<LocLabel Id="ntcp.quote.Button1.Button.ToolTipDescription">
<Titles>
<Title description="Add New Quote" languagecode="1033" />
</Titles>
</LocLabel>
<LocLabel Id="ntcp.quote.Button1.Button.Alt">
<Titles>
<Title description="Add New Quote" languagecode="1033" />
</Titles>
</LocLabel>
</LocLabels>
</RibbonDiffXml>
Any ideas?
Is this CRM2011 or CRM2013? If it is CRM2013 you can't add a new button on the Form Subgrids - only on the full related subgrid view.
Buttons are visible by default, so you don't need any special Display/Enable rules.
Hope this helps,
Scott

Adding a custom button to the advanced find robbon

I've got my customizations.xml importing ok, but when I open the Advanced Find Dialog, it tell me "Ribbon XML Validation Error":
I can't seem to get any more info than that. Below is my customizations.xml text, I've tried to simplify it as much as possible.
<ImportExportXml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Entities></Entities>
<Roles></Roles>
<Workflows></Workflows>
<FieldSecurityProfiles></FieldSecurityProfiles>
<Templates />
<RibbonDiffXml>
<CustomActions>
<CustomAction Id="DEW.Mscrm.AdvancedFind.Groups.Debug.UploadFetchXml"
Location="Mscrm.AdvancedFind.Groups.Debug._children" >
<CommandUIDefinition>
<Button Id="DEW.Mscrm.AdvancedFind.Groups.Debug.UploadFetchXmlButton" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates"></RibbonTemplates>
</Templates>
<CommandDefinitions>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules />
<EnableRules />
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>
<EntityMaps />
<EntityRelationships />
<OrganizationSettings />
<optionsets />
<Languages>
<Language>1033</Language>
</Languages>
</ImportExportXml>
For others looking to find the solution, or at least something to take note of if you're having a similar problem.
My problem was that the id for the different elements were the same. You must have unique id's even among different elements. And "Mscrm.AdvancedFind.Groups.Debug._children" should have been "Mscrm.AdvancedFind.Groups.Debug.Controls._children"

Looking for code to update a textbox on a SpreadsheetML doc (client using VB.Net but I can read and convert C#)

I have a 2010 Excel Spreadsheet (OpenXML) with a textbox "LengthVariableTextBox" on it. I wish to change the textbox value (currently ##.# just as a placeholder) using the openxml SDK with VB.Net (perfered) or C#. Below is a XML fragment from drawing7.xml showing the textbox.
Thanks for the Help!
M. Scott Blalock
<xdr:twoCellAnchor>
<xdr:from>
<xdr:col>2</xdr:col>
<xdr:colOff>502920</xdr:colOff>
<xdr:row>8</xdr:row>
<xdr:rowOff>45720</xdr:rowOff>
</xdr:from>
<xdr:to>
<xdr:col>3</xdr:col>
<xdr:colOff>510540</xdr:colOff>
<xdr:row>9</xdr:row>
<xdr:rowOff>76200</xdr:rowOff>
</xdr:to>
<xdr:sp macro="" textlink="">
<xdr:nvSpPr>
<xdr:cNvPr id="287" name="3:24 PM 9/19/2012" />
<xdr:cNvSpPr txBox="1" />
</xdr:nvSpPr>
<xdr:spPr>
<a:xfrm>
<a:off x="1722120" y="1386840" />
<a:ext cx="617220" cy="198120" />
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst />
</a:prstGeom>
<a:solidFill>
<a:schemeClr val="tx1" />
</a:solidFill>
<a:ln w="9525" cmpd="sng">
<a:solidFill>
<a:schemeClr val="lt1">
<a:shade val="50000" />
</a:schemeClr>
</a:solidFill>
</a:ln>
</xdr:spPr>
<xdr:style>
<a:lnRef idx="0">
<a:scrgbClr r="0" g="0" b="0" />
</a:lnRef>
<a:fillRef idx="0">
<a:scrgbClr r="0" g="0" b="0" />
</a:fillRef>
<a:effectRef idx="0">
<a:scrgbClr r="0" g="0" b="0" />
</a:effectRef>
<a:fontRef idx="minor">
<a:schemeClr val="dk1" />
</a:fontRef>
</xdr:style>
<xdr:txBody>
<a:bodyPr vertOverflow="clip" wrap="square" rtlCol="0" anchor="t" />
<a:lstStyle />
<a:p>
<a:r>
<a:rPr lang="en-US" sz="1100">
<a:solidFill>
<a:schemeClr val="bg1" />
</a:solidFill>
</a:rPr>
<a:t>##.#</a:t>
</a:r>
</a:p>
</xdr:txBody>
</xdr:sp>
<xdr:clientData />
</xdr:twoCellAnchor>
Here is the answer:
http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/3eb9075a-de13-4f4a-a83d-c42cdb6b8e98

What is the "Organize Usings" menu ID in Visual Studio 2010?

I'm creating a Visual Studio 2010 extension using a Package template, not an Add-in.
I want to add a menu item to the "Organize Usings" menu group that appears when you right-click in a .cs file. To do this, I need the guid and the id of that menu group.
<Button guid="myCmdSet" id="myButton" priority="0x0100" type="Button">
<Parent guid="guidSHLMainMenu (I think?)" id="???" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<CommandName>myCommand</CommandName>
<ButtonText>Do Stuff</ButtonText>
</Strings>
</Button>
I have looked here and here and here. Basically all around MSDN. Are these published, and does anyone know what they are?
EDIT: I found the related menu via this method, but I still don't have a way to find the menu group GUID/ID, which is what I really want.
OMG, I've spend 3 hours on this :D Here's the solution:
<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<Extern href="stdidcmd.h"/>
<Extern href="vsshlids.h"/>
<Extern href="msobtnid.h"/>
<Commands package="guidVSPackage1Pkg">
<Buttons>
<Button guid="guidCSharpGrpId" id="mySuperCommand" priority="0x0200" type="Button">
<Parent guid="guidCSharpGrpId" id="IDG_CSHARP_CTX_ORGANIZE" />
<Icon guid="guidImages" id="bmpPic1" />
<Strings>
<CommandName>mySuperCommand</CommandName>
<ButtonText>My super command</ButtonText>
</Strings>
</Button>
</Buttons>
<Bitmaps>
<Bitmap guid="guidImages" href="Resources\Images_32bit.bmp" usedList="bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows"/>
</Bitmaps>
</Commands>
<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="guidVSPackage1Pkg" value="{F066e284-dcab-11d2-b551-00c04f68d4db}" />
<GuidSymbol name="guidCSharpGrpId" value="{5d7e7f65-a63f-46ee-84f1-990b2cab23f9}">
<IDSymbol name="IDG_CSHARP_CTX_ORGANIZE" value="0x3618" />
<IDSymbol name="mySuperCommand" value="0x0100" />
</GuidSymbol>
<GuidSymbol name="guidImages" value="{cff24f4c-767f-48ee-aff4-6bdf8218cba0}" >
<IDSymbol name="bmpPic1" value="1" />
<IDSymbol name="bmpPic2" value="2" />
<IDSymbol name="bmpPicSearch" value="3" />
<IDSymbol name="bmpPicX" value="4" />
<IDSymbol name="bmpPicArrows" value="5" />
</GuidSymbol>
</Symbols>
</CommandTable>
You must place guidCSharpGrpId and IDG_CSHARP_CTX_ORGANIZE because they're not available in "standard" set of id's. By "standard" I'mean those placed in VisualStudioIntegration\Common\Inc directory within *.h files. They're hidden in cslangsvcui.dll library.
To get these ID's I've used VS Command Table PowerToy. You can download it from here:
http://archive.msdn.microsoft.com/VSCTPowerToy
Check this also as this thread:
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/697245ac-1596-4d6a-b55c-f5b01b69a583
In case that this solution won't work for you because some guids, etc. I've put zipped project on my SkyDrive:
https://skydrive.live.com/#cid=6A19F3A9B7B8E017&id=6A19F3A9B7B8E017!16486
Hope this helps :)

Resources