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

       private 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

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.

string WorkflowName

Gets the name of the describing Workflow.

ProcessInstanceState State

Gets the state 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

Fires if the process instance has been Run

event LoadAttributesCompletedEvent LoadAttributesCompleted

Fires if the process instance loaded Attributes



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