Platform SDK: Exchange 2000 Server

CompensatingAction Method

[This is preliminary documentation and subject to change.]

The workflow engine calls this method when a process instance transition gets aborted and the action table specifies a custom COM object as the compensating action. The custom COM object must implement this method.

[Visual Basic,VBScript]
Sub CompensatingAction(pSession as WorkflowSession)
[C++]
HRESULT _stdcall CompensatingAction(IWorkflowSession* pSession);
[IDL]
HRESULT _stdcall CompensatingAction([in] IWorkflowSession* pSession);

Remarks

When your action table includes the ProgID of a custom COM object as a compensating action, the workflow engine will create an instance of your COM object and call the CompensatingAction method that your COM object has implemented. COM objects can only be created in privileged-mode workflows, so the engine first checks to see if this ProcessInstance belongs to a privileged-mode workflow.

Example

In order to use this interface, you need to create your own COM object. If you implemented the following code in a dynamic link library and used the ProgID of your dll in the CompensatingAction field of a row in your workflow action table, when the workflow engine used that row the following CompensatingAction would execute for an aborted ProcessInstance transition:

[Visual Basic]
Implements CDOWF.ICustomActivity


Sub SendMail(MySubject, ByVal pSession As CDOWF.IWorkflowSession)

    Set MyMsg = CreateObject("CDO.Message")
    MyMsg.From = WorkflowSession.Sender
    MyMsg.To = MyMsg.From
    MyMsg.Subject = MySubject
    MyMsg.TextBody = pSession.StateFrom & " -> " & pSession.StateTo
    MyMsg.Send

End Sub


Sub CompensatingAction(ByVal pSession As CDOWF.IWorkflowSession)

    SendMail "Compensating Action", pSession

End Sub


Function EvaluateCondition(ByVal pSession As CDOWF.IWorkflowSession) As Boolean

End Function


Sub ExecuteAction(ByVal pSession As CDOWF.IWorkflowSession)

End Sub

See Also

IProcessDefinition_Mode

ICustomActivity