Ryan Rinaldi

.net development served with a slice of sarcasm
  • rss
  • About Me
  • Blog
  • Contact

CRM 4.0 Plug-ins: Handling Entity Merges

Ryan Rinaldi 11/12/2008 2:05:51 AM

In a recent post, CRM 4.0 Plugins, I said I would post an example of a plug-in that handles entity merges.  Here is that sample! :)

 

public class MergeHandler : IPlugin
{
    public MergeHandler (string unsecureConfig, string secureConfig)
    {
    }
 
    public void Execute(IPluginExecutionContext context)
    {
        try
        {
            if (context.MessageName == "Merge" &&
                context.PrimaryEntityName == "account")
            {
                string targetCrmId = ((Moniker)context.InputParameters[ParameterName.Target]).Id.ToString();
                string subOrdinateId = context.InputParameters[ParameterName.SubordinateId].ToString();
            }
        }    
        catch (Exception ex)
        {
            throw new InvalidPluginExecutionException(ex.Message, ex);
        }
    }

 

It's actually a lot easier than I thought.  It just took me awhile to understand what values were going to be passed into Execute method of the plug-in.

Comments
No Comments
Tags
blog

Leave a Comment

  • My Tweets

    • Looking at our options to move to TFS 2010 from 08 and change process template: just as painful to migrate off of TFS. sigh.
    • RT @Snywhip: I'm very proud of Spain and it's banning of the bull fights starting in 2012. Finally ;)
    • RT @adamtybor: @sergiopereira happy birthday!
    • Follow Me on Twitter
Powered by Graffiti CMS
  • Content © Ryan Rinaldi 2010
  • design by jide
  • Theme converted to GraffitiCMS by Adonis Bitar