CrmCalloutBase.PreMerge Method

banner art

Specifies a method called before a merge operation.

Syntax

[Visual Basic .NET]
Overridable Public Function PreMerge(
  ByVal userContext As CalloutUserContext,
  ByVal masterEntityContext As CalloutEntityContext,
  ByVal subordinateEntityContext As CalloutEntityContext,
  ByRef mergeUpdateEntityXml As String,
  ByRef errorMessage As String
) As PreCalloutReturnValue
[C#]
public virtual PreCalloutReturnValue PreMerge(
  CalloutUserContext  userContext,
  CalloutEntityContext  masterEntityContext,
  CalloutEntityContext  subordinateEntityContext,
  ref string  mergeUpdateEntityXml,
  ref string  errorMessage
);
[JScript]
public virtual function PreMerge(
  userContext : CalloutUserContext,
  masterEntityContext : CalloutEntityContext,
  subordinateEntityContext : CalloutEntityContext,
  mergeUpdateEntityXml : String,
  errorMessage : String
) : PreCalloutReturnValue;

Parameters

userContext

Contains information about the user who is performing the merge operation. See CalloutUserContext.

masterEntityContext

Contains information about the master entity being merged. See CalloutEntityContext.

subordinateEntityContext

Contains information about the subordinate entity being merged. See CalloutEntityContext.

mergeUpdateEntityXml

[ref] An XML string that describes the entity to be merged. This string may be modified during the execution of this method. This is a serialized version of DynamicEntity.

errorMessage

[ref] A string that contains the error message to be returned to the application. The error message string should not exceed 1,500 characters in length.

Return Value

Returns a PreCalloutReturnValue type that specifies what action to take after this method completes.

Example

The following code example shows how to log an object merge using a pre-callout.

public override PreCalloutReturnValue PreMerge(CalloutUserContext userContext,
                        CalloutEntityContext masterEntityContext,
                        CalloutEntityContext subordinateEntityContext,
                        ref string mergeUpdateEntityXml,
                        ref string errorMessage)
{
   TextWriter log = TextWriter.Synchronized(
     File.AppendText(@"C:\CRM_SDK_Drop\Merge.txt"));
   log.WriteLine("PreMerge");
   log.WriteLine("ObjectType: " +
     masterEntityContext.EntityTypeCode.ToString());
   log.WriteLine("ObjectId: " +
     masterEntityContext.InstanceId.ToString());
   log.WriteLine("CreatorId: " + userContext.UserId.ToString());
   log.WriteLine();
   log.Close();

   return PreCalloutReturnValue.Continue;
}

Namespace: Microsoft.Crm.Callout

Assembly: microsoft.crm.platform.callout.base.dll

See Also

© 2007 Microsoft Corporation. All rights reserved.