ProcessInstances class

Parent Previous Next

The ProcessInstances object specifies a collection of loaded ProcessInstances objects. An instance of the ProcessInstances collection is provided by the Session object.


Namespace:

IYOPRO.Api

Assembly:

IYOPRO.Api (in IYOPRO.Api.dll)


Syntax

       class ProcessInstances()


Members

void Load(Guid piid, object userdata = null)

Retrieves the process instance for the given id.

Userdata will be provided in the ProcessInstanceLoadedEventEventArgs

void Load(DateTime startDate, DateTime endDate,ProcessInstanceState state, List<string> names, List<string> variables, object userdata = null)

Provides a list of the available process instances

Userdata will be provided in the ProcessInstancesLoadedEventArgs

event ProcessInstanceLoadedEvent ProcessInstanceLoaded

The ProcessInstanceLoaded event is triggered if the Load method has finished

event ProcessInstancesLoadedEvent ProcessInstancesLoaded

The ProcessInstancesLoaded event is triggered if the Load method has finished



Sample

// Load the process instance with the specified id

Session session = ...;

Guid myid = ...;


ProcessInstances.ProcessInstanceLoadedEvent handler = null;

handler = (s, args) =>

{

session.ProcessInstances.ProcessInstanceLoaded -= handler;

Data = args.Data;

       ...

};

session.ProcessInstances.ProcessInstanceLoaded += handler;

session.ProcessInstances.Load(myid);



This sample is a script that can be run directly in IYOPRO. It shows how to load process instances that have a specific name and status and are within a specific time period

#IYOPRO.Backend

import clr

clr.AddReference("ServerBackend")

import IYOPRO.Api


import System


s = IYOPRO.Api.Session(Workflow)


start = System.DateTime(2020,1,1)

end = System.DateTime(2021,12,31)

names = System.Collections.Generic.List[str](["<process instance name>"])

vars = System.Collections.Generic.List[str]([])

e = s.ProcessInstances.Load(start,end,IYOPRO.Api.ProcessInstanceState.Finished,names,vars)