| Platform SDK: Exchange 2000 Server |
[This is preliminary documentation and subject to change.]
The workflow engine calls this method when the matching row in the action table specifies a custom COM object as the action. The custom COM object must implement this method.
[Visual Basic,VBScript] Sub ExecuteAction(pSession as WorkflowSession) [C++] HRESULT _stdcall ExecuteAction(IWorkflowSession* pSession); [IDL] HRESULT _stdcall ExecuteAction([in] IWorkflowSession* pSession);
When your action table includes the ProgID of a custom COM object as an action, the workflow engine will create an instance of your COM object and call the ExecuteAction 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.
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 Action field of a row in your workflow action table, when the workflow engine used that row the following action would execute:
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)
End Sub
Function EvaluateCondition(ByVal pSession As CDOWF.IWorkflowSession) As Boolean
End Function
Sub ExecuteAction(ByVal pSession As CDOWF.IWorkflowSession)
Dim FieldType
Dim CurrentState
CurrentState = ""
FieldType = 8 ' BSTR
SendMail "OnCreate Event", pSession
pSession.AuditTrail.AddEntry "WorkflowSession AuditTrail AddEntry is working"
CurrentState = pSession.Record.Fields("http://schemas.microsoft.com/cdo/workflow/currentstate").Value
If CurrentState <> "" Then
pSession.Record.Fields.Append CStr(CurrentState), FieldType, , , CStr(CurrentState)
pSession.Record.Fields.Update
End If
End Sub