Task Class
The Task object represents a workflow task which is triggered usually by a BPMN User Task Activity. Because it will be created by the workflow the task class does not have a public constructor. To access available tasks use the Tasks collection class.
Namespace: |
IYOPRO.Api |
Assembly: |
IYOPRO.Api (in IYOPRO.Api.dll) |
Methods
ProcessInstanceFile AddFile(string name, string path)
-
Add a local file to the process instance of the task. 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
APITaskPriority PriorityFromString(string priority)
-
Gets the priority number to the given priority string
void Run(bool finished, object userdata = null)
-
Continue the process instance. Finished specifies, if the task has been finished or not. Userdata will be provided in the resulting ProcessContinuedEventArgs
void Update(object userdata = null)
-
Updates the task. Userdata will be provided in the TaskUpdatedEventArgs
void LoadAttributes(List<string> attributes, object userdata = null)
-
Loads process instance attributes by their name and assigns them to the Attributes collection. Userdata will be provided in the LoadAttributesCompletedEventArgs
Properties
Guid GuId
-
Gets the unique identifier of the task
Guid PiGuId
-
Gets the unique identifier of the process instance
string PiName
-
Gets the name of the process instance
string PiDetails
-
Gets the details of the process instance
int WfId
-
Gets the Id of the describing Workflow
string Name
-
Gets the name of the task
DateTime CreatedAt
-
Gets the timestamp when the task has been created
DateTime PlannedAt
-
Gets the timestamp when the task is planned
DateTime FinishedAt
-
Gets the timestamp when the task is finished
string FinishedBy
-
Gets the name who finished the task
ProcessInstanceAttributes Attributes
-
Gets a collection of process instance attributes
APITaskPriority Priority
-
Gets the priority of the task
Events
LoadAttributesCompletedEvent LoadAttributesCompleted
-
The LoadAttributesCompleted event is triggered if the LoadAttributes method has finished
ProcessContinuedEvent ProcessContinued
-
The ProcessContinued event is triggered if the Run method has finished
UpdatedEvent Updated
-
The LoginCompleted event is triggered if the Update method has finished
Example
// 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);