Sunday, 31 August 2008
Hiding System Views in CRM 4.0
There is an alternative route, but it required plug-in coding. Rather than have to write code for each deployment, I created a standard plug-in that can be used to hide any views, based on some XML configuration. The source code and compiled code is available on the MSDN Code Gallery, along with a sample configuration file.
Friday, 29 August 2008
Plug-ins - differences between Target and Image Entity
- Via the Target InputParameter
- Via an Image Entity registered on the step
- Via a Retrieve request in the plug-in code
These do not always work in the same way, as follows:
Availability of the data by stage
The general rules are:
- InputParameter is available in all stages. It can be modified in the pre-stage, but changing it in the post-stage will have no effect
- A PostImage Entity is available in the post-stage, and a PreImage Entity in the pre-stage only
- If using a Retrieve in the plug-in, then the data returned depends on the stage. In the pre-stage, you will see the data before the modification, whereas in the post-stage you see the data after the modification
- Some Image Entities are not relevant for some messages - e.g. there is no PreImage for a Create message, and no PostImage for a Delete message
Data in the Name attribute
If the message is updating CRM (e.g. a Create or Update message) then the InputParameter only contains the minimum information that needs to be saved to CRM. A consequence of this is that the name attribute of any of the following data types is null:
- Lookup
- Owner
- Customer
- Picklist
- Boolean
So, if your code needs to access the name, then you cannot rely on the InputParameter, and have to use either the Image Entity or a Retrieve to get the data.
My preference is to use an Image Entity, mostly as this reduces the code I have to write. The CRM SDK also suggests that this is more efficient, though I've not done any thorough performance testing on this to determine if this is relevant.