ProcessInstance class

Parent Previous Next

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. Userdata 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. Userdata will be provided in the ReadLogCompletedEventArgs

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



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);