Search This Blog

Friday, April 29, 2011

How to: Which action raised OnSave event

A while ago, I wrote a post about the way to know which action raised the onSave event in Microsoft Dynamics CRM 4.0, here.

Here is the same code for Microsoft Dynamics CRM 2011:

// The execution context must be passed as the first parameter
// This can be done by ticking the checkbox in the function call
// window in the onSave event
function CheckSaveEvent(executionObj)
{
// If action is Save as closed (=58)
if(executionObj.getEventArgs().getSaveMode() == 58)
{
// Do some code logic
}
}




The check that must be ticked is the one in the below screenshot (This is the window that is displayed when adding script on the onSave event).


CRM 2011 RC1 [En fonction] - Oracle VM VirtualBox_2011-04-29_15-56-30

Wednesday, April 20, 2011

New tool: CrmDiagTool 2011

UPDATE: A new version is available on CodePlex

Hello CRM community!
Two months ago, Philippe Brissaud from Microsoft Canada asked me to help him migrate the well known CrmDiagTool 4 to Microsoft Dynamics CRM 2011. I guess you know what I answered him: of course I help!
Today, Philippe and I are proud to release this new version of CrmDiagTool.
We focused on Server diagnostics and removed features related to reporting services and email router.
The features are the following:
  • Enable/Disable tracing
  • Zip content of Trace directory
  • Open Trace directory
  • Generate diagnostic file in text or html format with components selection
  • Enable/Disable DevErrors
Some screenshots:
crmdiagtool2011_1
crmdiagtool2011_2
crmdiagtool2011_3
crmdiagtool2011_4
Regarding source code: As the previous version had not its source code released, this version does not too.
Download link:

Tuesday, April 19, 2011

How to: Change existing ribbon element properties

Today, I will try to explain you how to change properties of existing ribbon elements. For this example, I will change the label and icon of the button “New opportunity” in the main grid ribbon of the entity “Opportunity”.

The standard ribbon for the opportunity looks like the below one:

RibbonOpportunity1

And the result I expect:

RibbonOpportunity2

To obtain this result, follow the below procedure:

1 - If it is not already done, download the SDK (click here).

2 - Open the SDK folder “samplecode \ cs \ client \ ribbon \ exportribbonxml \ exportedribbonxml”. Then open the Xml file corresponding to the entity (here opportunity.xml). In our case, the button “Nouveau” (or “New” in english), is the one we need to retrieve:

<Button Id="Mscrm.HomepageGrid.opportunity.NewRecord" ToolTipTitle="$Resources:Ribbon.HomepageGrid.MainTab.New" ToolTipDescription="$Resources(EntityDisplayName):Ribbon.Tooltip.New" Command="Mscrm.NewRecordFromGrid" Sequence="10" LabelText="$Resources:Ribbon.HomepageGrid.MainTab.New" Alt="$Resources:Ribbon.HomepageGrid.MainTab.New" Image16by16="/_imgs/ribbon/NewRecord_16.png" Image32by32="/_imgs/ribbon/newrecord32.png" TemplateAlias="o1" />


3 - Create a new solution with the opportunity entity included and export it.


4 - Add a CustomAction with the correct location in the CustomActions node of the customizations.xml file contained in the exported solution archive. Only two attributes are required:



  • An identifier of your choice
  • A location (the location of the existing button): You will find the correct location in the parent node of the existing Xml button (in the opportunity.xml file). It is the attribute “Id” of the parent node. The location will be the concatenation of this id and the term “._children”.

5 – Add the Xml of the existing button


6 – Change the properties of the button (here, highlighted in yellow)


<RibbonDiffXml>
<CustomActions>
<CustomAction Id="MSCRMTools.HomepageGrid.opportunity.MainTab.Management.Controls"
Location="Mscrm.HomepageGrid.opportunity.MainTab.Management.Controls._children">
<CommandUIDefinition>
<Button Alt="$Resources:Ribbon.HomepageGrid.MainTab.New"
Command="Mscrm.NewRecordFromGrid"
CommandType="General"
Id="Mscrm.HomepageGrid.opportunity.NewRecord"
Image16by16="/_imgs/ribbon/NewRecord_16.png"
Image32by32="/_imgs/FormEntity/ico_fhe_3.png"
LabelText="Nouvelle"
Sequence="10"
TemplateAlias="o1"
ToolTipDescription="$Resources(EntityDisplayName):Ribbon.Tooltip.New"
ToolTipTitle="$Resources:Ribbon.HomepageGrid.MainTab.New" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates" />
</Templates>
<CommandDefinitions />
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules />
<EnableRules />
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>




7 – Import back the solution, that’s it!

Sunday, April 10, 2011

My CRM 2011 tools are now Claim based authentication compatible

Everything is on the title Sourire

Please take time to rate my tools on codeplex if you like them and if you really like them, you can even make a donation (see Paypal button on your right)

Many thanks to Alex Fagundes and PowerObjects for providing me a Claim Based authentication organization on their servers. It helps me a lot for testing my tools.

I owe you one, Alex !