ExecuteWorkflowEvent

You can use the function for Optiva Workflows.

Purpose

Processes an event for a workflow-in-progress.

Syntax


Dim variable As Object = ExecuteWorkflowEvent(WIP_ID, WIPLine_ID, Event)

Arguments

Part Description
WIP_ID Numeric. WIP ID of the started workflow from the Pending Tasks form.
WIPLine_ID Numeric. Line ID for the action step in the Workflow-in-Progress form that has the Queue Status of 1=In Process Queue.
Event Name of the event to execute. Some examples of events are Approve, Reject, and Complete. Events cannot have the comment, confirm, sign, or reason options enabled.

Description

This script is the equivalent of manually processing an event for an action step.

Error Messages

Examples of error messages for the ExecuteWorkflowEvent method:

If the EventCode argument is not one of the recognized events, then this message will be displayed:

Invalid event code %1.

If the Action for event being executed has the comment, confirm, sign, or reason options checked, then this message will be displayed:

Cannot launch ''%1'' event on WIP %2 line %3 because the Action ''%4'' requires a comment, confirmation, signature or reason.

Examples

This workflow exercises the CANCEL event for line 2 of WIP ID 3327. The WIP ID can be displayed in the Workflow in Progress form.

The user running the workflow enters the WIP_ID and WIPLINE_ID values as input parameters to the workflow.


Function wf_start() As Long 
Workflow.ExecuteWorkflowEvent(3327, 2, "CANCEL") 
RETURN 111 
End Function 

The WIP_ID and WIPLINE_ID values can be retrieved by ObjProperty on a pending workflow. The status of the workflow is in process.


Function wf_start() As Long 
Dim sWipId As String = CStr(Workflow.Context._WIPID)
Dim sLineId As String = CStr(Workflow.Context._WIPLINEID)
Workflow.ExecuteWorkflowEvent(sWipId, sLineId, "CANCEL") 
RETURN 111 
End Function