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 https://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.
Plugin_CTP3_VS2005_XML_example.rar
Comments
Anonymous
November 23, 2007
Hi Jonas I tried to import the Cusomtizations in the CRM4RC0 VPC. However it will not upload. Any chance you know what the problem with that is? Or do you have an newer version of it? Thx, RalfAnonymous
November 28, 2007
Unfortunately it’s not supported to move xml customizations from ctp1-3 to rc0. If I have the time I will try to update the project but since I'm on parental leave and don’t have too much time over...Anonymous
February 19, 2008
Hi Jonas, I tried your logger, but i have a problem registering your plugin. When using the plugin registration tool, i can get the assembly to register, but when i try to register the steps. No plugintype information shows up, and thus the registration can't be performed. Do you have any idea why this happens?Anonymous
February 21, 2008
Change <statuses nextvalue="-2147483648"> to <statuses> Comment out "<inproduction>1</inproduction>" and "<EntityName>New_logger</EntityName>"Anonymous
July 07, 2008
Alcohol and zoloft. Side effects of zoloft withdrawal. Tapering off zoloft.