CRM 4.0 Plugin Example a simple "Logger"
In CRM 3.0 callouts was the business extension and in 4.0 its name changed to Plugins. Still it's the entry point for doing business extensions extending the product or customizing it for your needs. The product group has done a great work on re-engineered the event architecture. Please look at UK CRM blog where Simon Hutson explains this very well. There is also good information in the so far published information in the SDK for CTP3.
My Plugin example is a simple logger. I created a new entity called "logger" with some basic field attributes. I also associated N-1 to systemusers table for keeping track of data been "logged" by current user. The logic to fill this entity/table is inside the plugin assembly and I have attached the Visual Studio project for you to play around with. Please note this is an example!
Possible areas where improvement could be done are:
Reports with summary. Triggered from the actual record for fast overview of logged information
JS logic with one click to logged record directly from user view (Store the PK as string and JS build a button with the url to the record)
Support for all the plug-in events. Current version is only CRED
Modify security groups (I haven't attached any roles to the example code)
And more and more... but then again this is just an example with not more than ~100lines of C# code
My logger entity is associated with all users in the system making it easy to overlook what has been logged on each user.
My logger plugin is associated with entities like account, contact and opportunity.
Instruction how-to build the Plugin registration tool is included in the CTP3/SDK documentation
Details of information from the logger form. Here we see all the fields a user (mscrm, lastname) has retrieved during a look at a contact.
For simplicity I use build events (see previous post http://blogs.msdn.com/jonasd/archive/2007/03/28/use-build-events-to-recycle-application-pool-instead-of-iisreset.aspx) in my Visual Studio project since you are required to IISRESET (I recycle CRMAppPool) before you could publish a new version of your plugin. I also don’t use the database as storage during development because I would like to debug my plugins. But! If your plugins should be runned in Outlook offline mode you should publish to database else it won't work.
If your CRM server is not on port 5555 you should change my webservice url. Customizations and Visual Studio project as attachments, Have fun!
This posting is provided "AS IS" with no warranties, and confers no rights.