Thursday, November 5, 2009

Who customize what and when?

The customization feature of Microsoft Dynamics CRM 4.0 is well known for being one of its best strengths. However, it lacks one essential feature nearly: The monitoring of theses customizations.

Indeed, it is impossible to know who does what in terms of customization and above what customizations were published.

With plugins and the famous capabilities of customization, it is relatively simple to set up an event log of customizations in Microsoft Dynamics CRM 4.0.

What you need is Plugins and one Custom Entity (let say “Customization Log”)


Plugins

Microsoft Dynamics CRM 4.0 provides us with several messages that allow us to track what is happening in terms of customizations the application.

There are two types of messages:

  • Import Messages
  • Publish Messages

Import Messages

They can give you two pieces of information:

  • The customization file that was imported (CompressedCustomizationXml property)
  • The entities or parameters that have been imported (ParameterXml property)

The messages are:

  • ImportCompressedAll
  • ImportCompressedWithProgress
  • ImportAll
  • Import
  • ImportWithProgress

Catch all these messages to be sure to monitor every import event.

In the case of imports, you can retrieve the customization file in the incoming properties (CompressedCustomizationXml) of the plugin context. So you can get the customization file during PRE stage (context.Stage == 10).

Publish Messages

They provide us with the list of entities that have been published (through the property ParameterXml of the plugin context).

The messages are:

  • PublishAll
  • Publish

Knowing this information, it is possible to export published entities customizations.

In the publish case, we only know the names of entities that are published. So, we must therefore export customization during POST stage to retrieve the customization file for the published items.

The plugin Process

In both cases (Import and Publish), we saw that we have the list of imported/published entities and the associated customization file.

So, our plugin has only one thing to do: create a record of "Log customizations" entity type that will contain the following information:

  • The type of operation: Import or Publish (which can be displayed as a picklist)
  • Entities involved stored in a memo field (because you can potentially have many imported/ published entities - Beware the maximum field size, therefore)
  • The customization file as an attachment

To make all this easier to use, we will take care of:

  • Bringing the notes section on the form first tab
  • Displaying the columns “type of operation”, “Actor”, “transaction date” and “entities involved” in the "Active Customization Logs” view.

Here it is! You have a monitoring feature for your customization !

BE AWARE of handling all exceptions because your imports will not work anymore if the plugin throw an exception

NOTE : To compare two customization files and know what have been updated, you can use the CRM Customization Comparison Utility provided by Microsoft on the CRM Team Blog

Custom web application and bin folder... Yes, but...

As you can see on the Best Practice of the CRM SDK (http://msdn.microsoft.com/en-us/library/dd548493.aspx), since rollup 2, you can put your custom assembly to your own web application bin folder instead of using the bin folder of the CRM web application.

Since a while, I didn't understand why this practice seemed to work for everybody except me...

The answer is simple: The assembly name can't contain any dot if you want it to work... It is a known bug by Microsoft.

As I was used to name my assemblies like .Crm.Web, it couldn't work...

I hope this will help some of you, guys!

Wednesday, October 14, 2009

Update : Form Javascript Manager

Today, I updated the form javascript manager with minor features

Change log:

  • When scripts are exported, you can now move to the Import tab automatically
  • Scripts are updated automatically in the tool when the files on disk are updated
  • It is now possible to import AND publish scripts in one action (you don't have to click on Import then on Publish)
  • You can Import/Publish using contextual menu or button
  • Encoding is better managed for non english language

Download:
As usual you can download the last version following this link


Monday, October 5, 2009

Important Update : View Layout Replicator

Hi,

This post to warn you about the existing version of ViewLayoutReplicator.

You can experience troubles with your lookup fields when browsing for records if you have replicated a public view to the search view of the lookup related entity.

The behavior is the following:

When selecting a record from the search window, the lookup field just contains the icon of the entity and not the primary attribute as the result of the selection. This is due to the "preview" attribute of the search view that should be "0" (and not "1" which happens if you used the ViewLayoutReplicator as described above).

To correct this behavior, simply download the new version of the tool and replicate the view again.

Thursday, October 1, 2009

New tool: XML Validator

Hi,

Today, a really small tool that helps to find error in CRM customization file. It is so boring to get the standard error message from the import customization page when your customization file is broken...

Of course, you can download and install tools like XMLSpy but it has too many funtions for me. So, I wrote a small tool that allows you to validate a XML file with a XSD file. It is generic and works also for other XML files than CRM one.

On the downloadable file, you will find the program and a XSD file which groups the three CRM XSD file used for the customizations (ExportImport, ISV.config and SiteMap).

You can select files (XML and XSD) by browsing the computer or by drag and drop.

I hope that will help some people, enjoy!


Download:

Tuesday, September 22, 2009

SiteMap, IFD/OnPremise and relative URLs

I don’t know if you've already faced this problem: When you develop a web page that you want displayed via the SiteMap Navigation, the URLs called are different depending whether you are in OnPremise or IFD mode.

In IFD, you get a URL like http://organization_name.domain.extension/ISV/default.aspx

In OnPremise, it will look like
http://organization_name.domain.extension/organization_name/ISV/default.aspx

I assume that you use the same URL to access both Dynamics CRM authentication mode.

Now, if you want to use relative URLs to load images, scripts or other (which are also contained in the ISV folder), you're facing a problem: how to use relative URLs to be valid for both IFD and OnPremise mode?

The simplest answer, which is often found on the forums, is: Use absolute URLs.

Certainly, but this is not very clean to use hard coded server names.

So I propose you my method. Maybe not the best but it does the job (even if, as we shall see, it still uses absolute URL).

In the code behind your ASP.Net page, create a new string property called BaseUrl.

In the Get accessor, write the following code:

public string BaseUrl
{
get
{
string baseUrl = string.Format("{0}://{1}",
Request.IsSecureConnection ? "https" : "http",
Request.Url.Host);

return baseUrl;
}
}



Then in the HTML content of your website, you can use the <% = BaseUrl %>wherever you want to reference relative URLs.

For example:

<img src="<%= BaseUrl %>/ISV/MyImages/Image.gif" > 


Well, it’s right, you still have an absolute URL in the source code of the page. But at least you do not have to worry about changing environments and authentication mode.

Note: If you need relative URLs on your scripts, you can replace the ".js" file by an ".aspx" file and perform the same manipulation as above.

Monday, September 21, 2009

Tools Update : IFD authentication supported

Hi all,

It's been a while since the last post... Unfortunately (or not, related to current economic context), I have lot of work these days and it's quite difficult to find time for my blog.

But nevertheless, I found time to update authentication process in my tools and they now all support IFD authentication.

The little extra concerns ViewLayoutReplicator and SearchablePropertyAttributeUpdater tools: they now use the same authentication assistant than the others tools.

You can still download them using right panel of this blog

Enjoy!