Related Topics
Workflow Class
The Workflow object is the legacy process model used in early versions of Process Director. BP Logix recommends the use of the Process Timeline object, and not the Workflow object. The Workflow object remains in the product for backwards compatibility, but doesn't receive any new functionality updates, other than required bug fixes. No new features have been added to this object since Process Director v4.5. All new process-based functionality is solely added to the Process Timeline.
This object represents a Workflow (definition and/or instance).
When developing Form scripts (in the various callback methods such as BP_Event) or Workflow scripts, you are automatically given an instance of the “current” Workflow with the CurrentWorkflow variable.
This object is derived from the Process class, which is, in turn, derived from the ContentObject class. All properties and methods from the ContentObject and Process classes are supported for this object, plus the properties below.
Properties
PROPERTY NAME | DATA TYPE | DESCRIPTION |
---|---|---|
WFID | String | The ID of the Workflow definition |
WFINSTID | String | The ID of the optional Workflow instance |
Methods


This API will add an item to a Workflow instance. This is an overloaded method with the following possible declarations:
public bool AddToWorkflow(string ID, ObjectType Type)
public bool AddToWorkflow(string ID, ObjectType Type, string Group)
Parameters
ID: ID of the object to add to the Workflow.
Type: Type of the object to add to the Workflow.
Group: Optional Group of the object to add to the Workflow.
Returns
Boolean: True if the operation succeeds.
Example
var oWorkflowInstance = Workflow.GetWorkflowByWFINSTID(bp, "WFINSTID");
oWorkflowInstance.AddToWorkflow("OBJID", ObjectType.Document);


This API will cancel a running Workflow instance.
Parameters
none
Returns
Boolean: True if the operation succeeds.
Example
var oWorkflowInstance = Workflow.GetWorkflowByWFINSTID(bp, "WFINSTID");
oWorkflowInstance.Cancel();


This API will get all children of the Workflow instance.
Parameters
ObjectType: Optional filter of object types to return.
MapType: Optional filter of map types to return.
GroupName: Optional filter of items in a Group to return.
Returns
List<ContentObject>: List of ContentObjects or null if the operation fails.
Example
var oWorkflowInstance = Workflow.GetWorkflowByWFINSTID(bp, "WFINSTID");
// Gets all Workflow items in a named group
var MyChildren = oWorkflowInstance.GetChildren("GroupName");


This API will get the specified WorkflowStep. This is an overloaded method with the following possible declarations:
public WorkflowStep GetWorkflowStepByName(string pStepName)
public static WorkflowStep GetWorkflowStepByName(bp BP, Workflow pWorkflow,
string pStepName)
Parameters
BP: The bp environment.
pStepName: The name of the Workflow Step to get.
pWorkFlow: The Workflow object containing the step.
Returns
WorkflowStep: The actual WorkflowStep or null if the operation fails.
Example
var oWorkflowInstance = Workflow.GetWorkflowByWFINSTID(bp, "WFINSTID");
var ApproveStep = oWorkflowInstance.GetWorkflowStepByName("StepName");


This API will get a Workflow definition object from the specified ID.
Parameters
BP: The bp environment.
WFID: The ID of the Workflow definition to retrieve.
Returns
Workflow: Will return null if Workflow isn't found.
Example
// Normally not used directly
var oWorkflowDef = Workflow.GetWorkflowByWFID(bp, "WFID");


This API will get a Workflow instance object from the specified ID.
Parameters
BP: The bp environment.
WFINSTID: The ID of the Workflow instance to retrieve.
Returns
Workflow: Will return null if Workflow isn't found.
Example
// Normally not used directly
var oWorkflowInstance = Workflow.GetWorkflowByWFINSTID(bp, "WFINSTID");


This API will jump to a specific Workflow Step.
Parameters
JumpFrom: Workflow Step name to jump from.
JumpTo: Workflow Step name to jump to.
Returns
Boolean: True if the operation succeeds.
Example
var oWorkflowInstance = Workflow.GetWorkflowByWFINSTID(bp, "WFINSTID");
// Restarts the Workflow instance at a specific step
oWorkflowInst.JumpToStep("FromStepName","ToStepName");


This API will jump to a specific Workflow Step.
Parameters
FromSTID: Workflow Step ID to jump from.
ToSTID: Workflow Step ID to jump to.
Returns
Boolean: True if the operation succeeds.
Example
var oWorkflowInstance = Workflow.GetWorkflowByWFINSTID(bp, "WFINSTID");
// Restarts the Workflow instance at a specific step
oWorkflowInst.JumpToStepID("FromSTEPID", "ToSTEPID");


This API will Post an event to a Workflow that is waiting on a wait step. This is an overloaded method with the following possible declarations:
public bool PostEvent(string EventName)
public static bool PostEvent(bp BP, string WFINSTID, string EventName)
Parameters
BP: The bp environment.
WFINSTID: The ID of the Workflow instance to retrieve.
EventName: The name of the event to Post.
Returns
Boolean: True if the operation succeeds.
Example
// Wake up a Workflow
Workflow.PostEvent(bp, "WFID", "EventName");


This API will start a Workflow Step that has previously completed.
Parameters
RestartStep: The WorkFlowStep object of the step to restart.
Returns
Boolean: True if the operation succeeds.
Example
// Restarts the Workflow Step
WorkflowStep myStep = GetWorkflowStepByName("StepName");
ReStart(myStep);
Documentation Feedback and Questions
If you notice some way that this document can be improved, we're happy to hear your suggestions. Similarly, if you can't find an answer you're looking for, ask it via feedback. Simply click on the button below to provide us with your feedback or ask a question. Please remember, though, that not every issue can be addressed through documentation. So, if you have a specific technical issue with Process Director, please open a support ticket.