Search This Blog

Loading...

Friday, January 27, 2012

New tool : Documentation generator

Hi guys,

What is more awful than writing documentation about entities and attributes used in a project? Can’t see…

I love the tool from Sonoma Partners to generate documentation but it has some limitations:

  • Only OnPremise deployments are supported
  • It generates only Excel document
  • It is a command line utility (I do love UI…)

So, today, I released my own document generator. It can generate Excel or Word document and provide some options to select what you want to see in the generated documentation. Read the documentation on CodePlex for more information about options.

image

As usual, CodePlex link, don’t foget to rate it if you like it, you can support me by making a donation on PayPal.

Please prefer CodePlex discussion to ask question, report bug

Thursday, January 26, 2012

How to colorize grid rows…

Since early days of Dynamics CRM, I’m thinking that Microsoft should provide a way to add conditional colorization for entities grid views. It was possible to do so in CRM 4.0 by modifying some system files but it had two limitations:

  • This was not supported
  • This was not usable in CRM online or if you did not have access to the server file system

In CRM 2011, I found a way to add color to entities grids using the ribbon, even if there are still two limitations:

  • This is still not supported (as I browse and change DOM as you will see below) but does not required access to the filesystem
  • Ribbon element that helps me to colorize the grid view can’t be hidden and it is useful just to add color, it should then not be visible…

As a reminder, the following procedure is not supported but you can use it at your own risk.

Three elements are required:

Ribbon button

This button is added in the HomePageGrid of an entity (but could also be added to SubGrid). It has an Enable rule that perform the grid colorization and returns always false to be deactivated. This is the last remaining difficulty, the SDK doesn’t allow to use a customRule to manage DisplayRule, so we can just deactivate the button.

<RibbonDiffXml>
<CustomActions>
<CustomAction
Id="McTools.HomePageGrid.contact.Colorization"
Location="Mscrm.HomepageGrid.contact.MainTab.Actions.Controls._children"
Sequence="10">
<CommandUIDefinition>
<Button
Command="ColorizeView.Command"
CommandType="General"
Id="McTools.HomePageGrid.contact.Colorization.Button"
Image32by32="/_imgs/Ribbon/Actions_32.png"
LabelText="Colorize"
Sequence="10"
TemplateAlias="o1" />
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates" />
</Templates>
<CommandDefinitions>
<CommandDefinition Id="ColorizeView.Command">
<EnableRules>
<EnableRule Id="ColorizeRule" />
</EnableRules>
<DisplayRules />
<Actions />
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules>
<DisplayRule Id="testRule">
<CrmClientTypeRule
Default="false"
InvertResult="false"
Type="Outlook" />
</DisplayRule>
</DisplayRules>
<EnableRules>
<EnableRule Id="ColorizeRule">
<CustomRule
Default="true"
InvertResult="false"
FunctionName="load"
Library="$webresource:mctools_/ColorView/jQuery_1_7_1.js" />
<CustomRule
Default="false"
InvertResult="false"
FunctionName="load"
Library="$webresource:mctools_/ColorView/Scripts.js">
<CrmParameter Value="SelectedControlAllItemReferences" />
<CrmParameter Value="SelectedControl" />
</CustomRule>
</EnableRule>
</EnableRules>
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>




jQuery library

Download the latest version from jQuery web site and add a new function to permit load of this script file from ribbon. jQuery will help us writing faster code…


function load() {
// Do nothing
}

A custom library

The custom library has a unique function with two parameters:


  • A list of entityReference that contains the grid elements displayed
  • The grid control itself

In this script, I want to colorize male contact in blue and female contact in pink.

I need to retrieve the index of the column that contains the attribute gendercode

var index = $("#gridBodyTable").find("col[name=gendercode]").index();

Then for each entityReference, retrieve the grid row that corresponds to the record

for(var i=0;i<items.length;i++)
{
var id = items[i].Id;

$(grid._element).find("tr[oid='" + id + "']").each(function()
{
// ...
}
}




Check the value of gendercode

if(theTr.find("td:nth-child(" + (index/1 + 1/1) + ")")[0].innerText.indexOf("Homme") >= 0)
{
// ...
}




Apply color

theTr.find("td").css("background-color","lightblue");


Final Script


function load(items, grid)
{
try
{
if(items)
{
var index = $("#gridBodyTable").find("col[name=gendercode]").index();

for(var i=0;i<items.length;i++)
{
var id = items[i].Id;

$(grid._element).find("tr[oid='" + id + "']").each(function()
{
var theTr = $(this);

if(theTr.find("td:nth-child(" + (index/1 + 1/1) + ")")[0].innerText.indexOf("Homme") >= 0)
{
theTr.find("td").css("background-color","lightblue");
}
else if(theTr.find("td:nth-child(" + (index/1 + 1/1) + ")")[0].innerText.indexOf("Femme") >= 0)
{
theTr.find("td").css("background-color","pink");
}
});
}
}
}
catch(e)
{
alert(e.description);
}
}




Screenshot


ColorizedView

Saturday, January 21, 2012

New tool ? No… New assembly!

As some of you might have noticed, new versions of my tools are using an assembly called McTools.Xrm.Connection.

This assembly is one of mine… I just extracted connection specific classes from my tools project and created this assembly.


image

I was wondering if I should make it public… it is, now… That should helps developers to create application without thinking about how to connect to CRM Online, OnPremise or IFD… This assembly should do it for you…

I wrote a small documentation on CodePlex to help you include this assembly in your projects.
You can access this assembly, its documentation and source code on CodePlex : http://connectioncontrol.codeplex.com
 
Just one more thing: Use this assembly in any project you want. If your project will be publicly released, you should indicates that you used this assembly (in an “about” form or anywhere else).

Thanks!
Hope this helps!

Friday, December 23, 2011

CRM 2011 Ribbon: Using other controls than just Group and Button : ColorPicker!

Hi,

As you might know, I developed some tools for ribbon usage (even if some of them are not really usable right now). Yesterday, I tried to use a ColorPicker control to check the behavior of my ribbon editor and found some inconstancy in the SDK.

Anyway, I wanted to try a ColorPicker control and try it in real life scenario (or something useful for your/my customers).

Here is the scenario: I want to be able to flag an account with a color (just like Outlook categories for email, appointment, etc.). For this, I will add a color picker on the ribbon and update the color of the form header (thanks to customer effective for this part: Changing the form header and footer colors).

The final look I expect:

CRM 2011 [En fonction] - Oracle VM VirtualBox_2011-12-22_22-39-31

What I need:

A solution with an image for my button, a script for changing header color, jQuery library to ease the write of scripts. The entity account is here since I apply the ColorPicker to this entity.

CRM 2011 [En fonction] - Oracle VM VirtualBox_2011-12-23_09-00-34

Script content:

function ApplyColorToHeader(commandProperties)
{
var filter = "";

if(commandProperties.Color != "#FFFFFF")
{
filter = "progid:DXImageTransform.Microsoft.Gradient(startColorstr=" + commandProperties.Color + ",endColorstr=#f6f8fa);";
}

$(".ms-crm-Form-HeaderContainer").css("filter", filter);
}

RibbonDiffXml:

<RibbonDiffXml>
<CustomActions>
<CustomAction
Id="ColorPicker.CustomAction"
Location="Mscrm.Form.account.MainTab.Actions.Controls._children"
Sequence="100">
<CommandUIDefinition>
<FlyoutAnchor
Id="McTools.Form.account.MainTab.Actions.ColorPicker.Flyout"
Sequence="130"
Alt="Color this form"
LabelText="Color this form"
Command="McTools.Form.account.MainTab.Actions.ColorPicker.Command"
PopulateDynamically="false"
PopulateOnlyOnce="true"
TemplateAlias="o1"
Image32by32="$webresource:mctools_/ColorPicker/Icon32.png"
ToolTipTitle="Color this form"
ToolTipDescription="Apply a color to this form header">
<Menu Id="McTools.Form.account.MainTab.Actions.ColorPicker.Menu">
<MenuSection
Id="McTools.Form.account.MainTab.Actions.ColorPicker.Menu.MenuSection"
Title="Choose a color">
<Controls Id="Ribbon.ListItem.Workflow.Controls.CPFlyout.Menu.MenuSection.Controls">
<ColorPicker
Id="McTools.Form.account.MainTab.Actions.ColorPicker.Menu.MenuSection.ColorPicker"
Command="McTools.Form.account.MainTab.Actions.ColorPicker.CommandPicker">
<Colors>
<Color Title="Red" DisplayColor="#FF0000" Color="#FF0000" />
<Color Title="Green" DisplayColor="#00FF00" Color="#00FF00" />
<Color Title="Blue" DisplayColor="#0000FF" Color="#0000FF" />
<Color Title="Cancel Color" DisplayColor="#FFFFFF" Color="#FFFFFF" />
</Colors>
</ColorPicker>
</Controls>
</MenuSection>
</Menu>
</FlyoutAnchor>
</CommandUIDefinition>
</CustomAction>
</CustomActions>
<Templates>
<RibbonTemplates Id="Mscrm.Templates">
</RibbonTemplates>
</Templates>
<CommandDefinitions>
<CommandDefinition Id="McTools.Form.account.MainTab.Actions.ColorPicker.Command">
<EnableRules />
<DisplayRules />
<Actions />
</CommandDefinition>
<CommandDefinition Id="McTools.Form.account.MainTab.Actions.ColorPicker.CommandPicker">
<EnableRules />
<DisplayRules />
<Actions>
<JavaScriptFunction
Library="$webresource:mctools_/ColorPicker/jQuery_1_7_1.js"
FunctionName="load" />
<JavaScriptFunction
Library="$webresource:mctools_/ColorPicker/Scripts.js"
FunctionName="ApplyColorToHeader">
<CrmParameter Value="CommandProperties" />
</JavaScriptFunction>
</Actions>
</CommandDefinition>
</CommandDefinitions>
<RuleDefinitions>
<TabDisplayRules />
<DisplayRules />
<EnableRules />
</RuleDefinitions>
<LocLabels />
</RibbonDiffXml>

Some explanations:

The ribbonDiffXml is made of a FlyoutAnchor that inclues the ColorPicker.

Then, we need two CommandDefinition items:


  • One for the FlyoutAnchor
  • One for the ColorPicker

 

The ColorPicker’s CommandDefinition calls the JavaScript function “ApplyColorToHeader” passing Crm parameter “CommandProperties”. This JavaScript object contains the property “Color” that contains the value of the attribute “Color” of the clicked Color item.

 

Result:

 

After having clicked on Green color

CRM 2011 [En fonction] - Oracle VM VirtualBox_2011-12-22_22-40-13

 

To switch back to the normal form color, I can click on the white color

Sans titre (100%) - Paint.NET v3.5

 

The original color is back!

CRM 2011 [En fonction] - Oracle VM VirtualBox_2011-12-22_22-42-18

 

Next steps:

To finish the scenario, it would be necessary to store the selected color in a hidden field. Then, in OnLoad event, the header should also be changed with the color selected.

Friday, December 2, 2011

The path to fame: New version of CRM 2011 SDK

Microsoft just released a new version of CRM 2011 SDK!

If you look deeply into it to gather information about the SiteMap, you could find my name somewhere Sourire

 image

Look the page here

Monday, November 28, 2011

Tool update: CrmDiagTool2011 with access to remote CRM servers

Hi CRM community!

Last Friday and today, with my colleague Nicolas, we released a new version of CrmDiagTool 2011.

This version has not the capability to connect to remove CRM servers to manage Trace and DevErrors flag. This should save you time, removing the need to connect with a remote desktop to CRM servers…

This feature is not available for the Troubleshooting report.

If you missed the previous update, you can now save your trace profile to reuse it quickly.

Enjoy! (on codeplex, as usual)

image

Wednesday, November 9, 2011

New tool : Solution Import for Microsoft Dynamics CRM 2011

Hi,

Today, I released a little tool to ease the import of solution in Microsoft Dynamics CRM 2011.

It displays a simple UI where you can :

  • change import settings
  • Drag & drop a solution file (Zip)
  • Define a path containing the extraction of a solution file

image_thumb[2]

I hope this will help you a bit...

As usual, the tool is on CodePlex

Enjoy!