The ProcessInstance object represents a process instance of a workflow. A process instance does not have a public constructor. It can be created using the CreateProcessInstance method of the Workflow class.
Namespace: |
IYOPRO.Api |
Assembly: |
IYOPRO.Api (in IYOPRO.Api.dll) |
Syntax
class ProcessInstance()
Members
ProcessInstanceFile AddFile(string name, string path) |
Add a local file to the process instance. Keep in mind that you should also assign the internal filename to a process instance variable to be able to access the file later |
|
void RemoveFile(string internalname) |
Removes a file from the process instance. Remember to remove the file also from the referencing process instance variable |
|
void Run(object userdata = null) |
Continue / Start the process instance. User data will be provided in the resulting ProcessStartedEventArgs |
|
void LoadAttributes(List<string> attributes,object userdata=null) |
Load process instance attribute values and append them to the Attributes collection. Userdata will be provided in the LoadAttributesCompletedEventArgs |
|
void ReadLog(bool deep=false,object userdata=null) |
Read the process instance log. Specify with "deep" whether logs from subprocesses should also be loaded. User data will be provided in the ReadLogCompletedEventArgs |
|
void Delete(object userdata = null) |
Delete the process instance. User data will be provided in the resulting DeleteIstanceCompletedEventArgs |
|
int Id |
Gets the Id of the process instance |
|
Guid GuId |
Gets the unique identifier of the process instance |
|
string Name |
Gets the name of the process instance |
|
int WorkflowId |
Gets the Id of the describing Workflow |
|
int WorkflowFileId |
Gets the Id of the workflow file |
|
string WorkflowName |
Gets the name of the describing Workflow |
|
int WorkflowVersion |
Gets the version of the workflow |
|
string WorkflowVersionName |
Gets the name of the workflow version |
|
ProcessInstanceState State |
Gets the state of the process instance |
|
string InstanceInfo |
Gets the information of the process instance |
|
string CreatedBy |
Gets the name of the process instance creator |
|
DateTime CreatedAt |
Gets the timestamp when the process instance has been created |
|
DateTime FinishedAt |
Gets the timestamp when the process instance is finished |
|
ProcessInstanceAttributes Attributes |
Gets a collection of process instance attributes |
|
TailoredActivities Tailor |
Gets a collection of tailored activities |
|
Roles Roles |
Gets a collection of roles defined in the process instance |
|
event ProcessStartedEvent ProcessStarted |
The ProcessStarted event is triggered if the Run method has finished |
|
event LoadAttributesCompletedEvent LoadAttributesCompleted |
The LoadAttributesCompleted event is triggered if the LoadAttributes method has finished |
|
event ReadLogCompletedEvent ReadLogCompleted |
The ReadLogCompleted event is triggered if the ReadLog method has finished |
|
event DeleteIstanceCompletedEvent DeleteIstanceCompleted |
The DeleteIstanceCompleted event is triggered if the Delete method has finished |
Sample
// Add the Pdf to our process instance
ProcessInstanceFile pif=Task.AddFile("My Documentation", "c:\\temp\\File.pdf");
// Add the Pdf to our process attribute, that contains the file list
List<object> files = Task.Attributes.Get("Files") as List<object>;
files.Add(pif.InternalName);
// Finish the task
Task.Run(true);
This sample shows how to delete 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, False)
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)
if e.Error:
raise e.Error
for inst in e.Data:
ProcessInstance.Info("Removing instance " + unicode(inst.Id))
d = inst.Delete()
if d.Error:
raise d.Error