Welcome to MSDN Blogs Sign in | Join | Help

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.

    Published Monday, November 05, 2007 2:08 PM by Jonas Deibe
    Filed under: , ,

    Attachment(s): Plugin_CTP3_VS2005_XML_example.rar
  • Comments

    # http://crmwatcher.com/2007/11/nice-crm-40-plugin-example-logger.html

    Wednesday, November 14, 2007 12:35 PM by TrackBack

    # http://google.com/search?sourceid=navclient&aq=t&ie=utf-8&rlz=1t4ggih_enus233us233&q=crm+4.0+plug+in

    Wednesday, November 14, 2007 12:36 PM by TrackBack

    # re: CRM 4.0 Plugin Example a simple "Logger"

    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, Ralf

    Friday, November 23, 2007 8:28 AM by ralf_van_gellekom@hotmail.com

    # re: CRM 4.0 Plugin Example a simple "Logger"

    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...

    Thursday, November 29, 2007 3:39 AM by Jonas Deibe

    # re: CRM 4.0 Plugin Example a simple "Logger"

    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?

    Wednesday, February 20, 2008 6:05 AM by Iskandar Prins

    # re: CRM 4.0 Plugin Example a simple "Logger"

    Change <statuses nextvalue="-2147483648"> to <statuses>

    Comment out "<inproduction>1</inproduction>" and "<EntityName>New_logger</EntityName>"

    Thursday, February 21, 2008 10:53 AM by jziegler@ronco.net

    # Weight gain and zoloft.

    Alcohol and zoloft. Side effects of zoloft withdrawal. Tapering off zoloft.

    Monday, July 07, 2008 7:42 PM by Zoloft.
    Anonymous comments are disabled
     
    Page view tracker