Workflow class

The Workflow object represents a workflow definition.

Namespace:

IYOPRO.Api

Assembly:

IYOPRO.Api (in IYOPRO.Api.dll)

 Methods

ProcessInstances CreateProcessInstance()

Creates a new process instance based on the workflow definition

void GetProcessInstances(List<string> names,DateTime startDate, DateTime endDate, ProcessInstanceState states, List<string> attributes, object userdata = null)

Retrieves process instances for the given workflow.
Names is an optional filter for process instance names.
StartDate and endDate are filters and specify the time range for the finishedDate of these process instances, which are finished.
States specifies, at what state the retrieved instances must be.
Attributes specify a list of process instance variable names, which schould be retrieved.
Userdata will be provided in the ProcessInstanceListLoadedEventEventArgs

 Properties

int Id

Gets the Id of the workflow

string Name

Gets the name of the workflow

string PlainDescription

Gets the description of the Workflow

 Events

ProcessInstanceListLoadedEvent ProcessInstanceListLoaded

The ProcessInstanceListLoaded event is triggered if the GetProcessInstances method has finished

Examples

// Load Workflow definition and create process instance
Workflows wf = session.Workflows;
// STEP 1: Load the Workflow
Workflows.WorkflowLoadedEvent handler = null;
handler = (s, args) => {
    wf.WorkflowLoaded -= handler;
    Workflow w = args.Workflow;
    if (w == null) return;
    // STEP 2: Create a Process Instance
    ProcessInstance pi = w.CreateProcessInstance();
    pi.Attributes.SetValue("email", "noreply@iyopro.com");
    // STEP 3: Run the Process Instance
    pi.Run();
};
wf.WorkflowLoaded += handler;
wf.Load(workflowid);

// Load process instances of that workflow
Workflows wf = session.Workflows;
Workflows.WorkflowLoadedEvent handler = null;
handler = (s, args) =>
{
    wf.WorkflowLoaded -= handler;
    Workflow w = args.Workflow;
    Workflow.ProcessInstanceListLoadedEvent wlhandler = null;
    wlhandler = (wls, wle) =>
    {
        w.ProcessInstanceListLoaded -= wlhandler;
        List<ProcessInstance> instances = wle.Data;
        ...
    };
    w.ProcessInstanceListLoaded += wlhandler;
    // Load only process instances with the name "my process instance name"
    List<string> names=new List<string>(){ "my process instance name" };
    w.GetProcessInstances(names, DateTime.MinValue, DateTime.MaxValue, ProcessInstanceState.All, new List<string>() { "email","myuuid" });
};
wf.WorkflowLoaded += handler;
wf.Load(workflowid);