SetStateDynamicEntity on Incident Entity

I wrote a plug-in that needs to perform some validation when a user tries to close an Incident record in CRM and verify whether it can be closed or not. I registered it against the SetStateDynamicEntity, however it didn’t trigger. I then registered it against the Create of the IncidentClose entity, but it didn’t trigger there either (probably because I registered in the parent pipleine rather than the child). I then realised there is a Close message and registered against that instead, and it worked!

The SetStateDynamicEntity message is only triggered when an Incident is re-activated after being closed.

Change default Public View using Plug-In

One of the things I get asked a lot about is having different Views on Entities for different users. This is possible using a Plug-In. I’ve attached a sample showing how to change defaults (and hide views) depending on the user’s security role. The plug-in has to be registered for the RetreieveMultiple message on the savedquery entity to be be executed in the post stage (I have also included an export from the registration tool).

In this example I’m setting two different default views depending on whether the user is a Sales Person (My Active Contacts) or a Sales Manager (Active Contacts) and in addition, hiding a view if the user is a Sales Person.