PreEntityImages and PostEntityImages In CRM 5.0 / 2011 Plugins

PreEntityImages :

It is basically used to capture the data when the form loads. That is the data which is present by default when the form loads.  The syntax for using the PreEntityImages in CRM 2011 is changed as compared to CRM 4.0. Remember the PreEntityImages cannot be registered for “create” operation.

Syntax Used in CRM 2011 :

Suppose you registered the Plugin and added a Image with name “PreImage

Entity preMessageImage;

if (context.PreEntityImages.Contains(“PreImage”) && context.PreEntityImages[“PreImage”] is Entity)


preMessageImage = (Entity)context.PreEntityImages[“PreImage”];

accountnumber = (String)preMessageImage.Attributes[“accountnumber”];


Here Entity is an Class that is available in the Microsoft.Crm.Sdk.dll

PostEntityImages :

The Post Image contains the attributes value which are finally changed. We can capture the changed data before the database operation takes place. And can do any kind of validation based on the changed data. Remember it can only be registered  for update message and cannot be registered on create message.

Syntax Used in CRM 2011 :

Suppose you registered the Plugin and added a Image with name “PostImage

Entity postMessageImage;

if (context.PostEntityImages.Contains(“PostImage”) && context.PostEntityImages[“PostImage”] is Entity)


postMessageImage = (Entity)context.PostEntityImages[“PostImage”];

accountnumber = (String)postMessageImage.Attributes[“accountnumber”];


The PreEntityImages and PostEntityImages are Very useful in Scenarios where we want to compare the data that is changed by the user. Based on the changes the custom operation can be performed.

The below PLugin shows the use of PreEntityImages and PostEntityImages.The plugin creates a contact record when a account record is updated. The plugin uses late binding or Dynamic Entity concept for the creation of the record.

PreEntityImages concept


, , , ,

  1. #1 by theenerd on May 13, 2012 - 7:15 pm

    Great Tutorial

    Thanks for sharing

  2. #2 by crm dynamics on August 19, 2012 - 7:58 pm

    Reblogged this on Welcome You all.

  3. #3 by Berniece on August 28, 2012 - 12:08 pm

    Hey there would you mind sharing which blog platform you’re working with? I’m looking to
    start my own blog soon but I’m having a tough time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something
    completely unique. P.S My apologies for being off-topic but I had to

  4. #4 by chiflado on April 27, 2013 - 2:32 am

    It feels like I’ve come across this blog before on but after browsing at some of the articles I realized it’s new to
    me. Still, I’m gonna bookmark this blog and start coming here regularly.

  5. #5 by naoid on October 3, 2013 - 5:05 pm

    We stumbled over here coming from a different page
    and thought I should check things out. I like what I see so now i am following you.
    Look forward to looking over your web page again.

  1. CRM2011 Plugins, Pre-image and post-image -Kevin's Mocha

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: