Monday, December 13, 2010

How to Hide System Views in CRM 4.0

This post could also be titled, how to pass configuration to CRM Plugins.  I found a sample solution in the MSDN Code Gallery but the installation details were left to the imagination.  Fortunately another person posted on how to hard-code a plugin with the Assembly Registration information needed.  First you register the assembly, then add a step with this information:

 

Message: RetrieveMultiple
Primary Entity: savedquery
Stage of Execution: Post Stage
Execution Mode: Synchronous

Unsecure Configuration: <the XML from the sample config file>

 

There was a problem with the code from the gallery in that the constructor for plugins seems to have changed.  Plugin constructors require two string parameters as detailed in this blog post.  The first is the “unsecure configuration” and the second is the “secure configuration”.

 

The nice thing is that the views are hidden as soon as you “Update” the Step Registration.  No need to restart CRM or anything fancy. 

 

You can download the source of my plugin here (6 Kb zip) (you may have to update the references to the SDK dlls).

No comments: