Wiki Link: [discussion:3442]
Example of Plugin with "Merge" message? 

May 24 2010 at 11:27 PM

I was curious if anyone had an example of a plugin that fired on the "Merge" message for a Contact.

The xml for the register.xml file would also be very helpful.


Oct 20 2010 at 7:45 PM
Here is an example of Merging 2 accounts. Merging contacts should be similar.

The Registration XML for Merge step will look something as follows.

<- <Step PluginTypeName="MyPluginDLL.MyPluginType" PluginTypeFriendlyName="67f077b9-760f-45f3-a4a2-673a56805a58" Description="Merge of account in Parent Pipeline" FilteringAttributes="" ImpersonatingUserId="" InvocationSource="0" MessageName="Merge" Mode="0" PrimaryEntityName="account" SecondaryEntityName="none" Stage="50" SupportedDeployment="0" Rank="5" Id="eaeff6c9-c3d7-df11-84b1-02bfac141338">
<- <Images>
< <Image EntityAlias="PreImageSubordinate" ImageType="0" MessagePropertyName="subordinateid" Attributes="accountid" Id="73d9a0cd-d2d7-df11-84b1-02bfac141338" />

1) Register a step for Merge message using Plug-in Registration tool. Choose Message=Merge and Entity = Account. This step will send information about MergedTo Account in the context object.
2) Register an Image under Merge step. On save, a popup message will be shown “Do you want to register for the Image on Parent Entity> Yes-Parent, No-Subordinate Entity”. Choose No for registering Subordinate account that was deactivated.

Following is the code sample that gets the information about MergedTo account and Subordinate account.

if (context.InputParameters.Properties.Contains("Target") && context.InputParameters.Properties"Target" is Moniker)

//1.Getting the information on MergetTo account (Parent account)
Moniker mergeMoniker = (Moniker)context.InputParameters.Properties"Target";

recordGUID = mergeMoniker.Id;
entityName = mergeMoniker.Name;

//2.Getting the information on Subordinate account (that was deactivated)

DynamicEntity PreImageSubordinate;
PreImageSubordinate = (DynamicEntity)context.PreEntityImages"PreImageSubordinate";
recordGUID = ((Key)PreImageSubordinate.Properties"accountid").Value;


Page view tracker