1. Workflow activity - Task

    Article: AN0002057Updated:

    This activity ensures creation of a task and  optional sending of an informative e-mail. The task is assigned to a particular user or group of users which are expected to enter data and save the task. Before task completion workflow is suspended in corresponding branch. After task completion workflow continues in its course.

    The work with tasks is described in detail at the workflow chapter.

    Activity properties

    Name Description
    Name Name of the activity. It is displayed in the scheme and used in the workflow log.
    Description Description of the activity. It is displayed after moving the move on the activity in the scheme.
    Task class Class in the ObjectGears system in which tasks are created.
    Code Code of the task. It helps to differentiate particular tasks within one workflow.
    Category Task category. It helps to identify similar tasks over various workflows.
    Complete within days Number of days in which the task shall be completed.
    Action Action, that shall be performed after the user performs the task.
    Send a default mail after creation When checked off, user/s to whom the task is assigned receive an informatory e-mail about the task after its creation.
    Initialization script Script that will run before the task creation.
    Script after user entry Script that will run after the task completion by the user.


    Class of the task

    Every task needs to have a class that contains three specific columns (Assigned, Completed, Deadline). Tasks are saved into this class. Every task may have its separate class or they share the class.

    You do not need to set access rights to the class in order that user can update the tasks. ObjectGears system finds itself which user is authorized to work on the task. However, you can set the access right in the class in order to check the tasks like records in any other class.

    Column Assigned defines which user/s shall carry out the task.

    Column Completed informs about the percentage of the task completion by the user. It is useful mainly for long term tasks. value in this column is updated directly by the user. After the task is marked as completed it is automatically set to 100%.

    Column Deadline is the planned date till when the task shall be completed by the user. It is an informatory value that can help the user better plan his work and prioritize between tasks.

    The task can be assigned also to a group of users, if the class contains column User group (see creation of a new column - Columns for WF tasks).

    Note: At the first saving of the Task activity the above columns are mapped to the activity. If we need to use another class or another columns later on, it is necessary to create a new activity and cancel the original one. It is not sufficient to create a new workflow version and reconfigure the activity.

    Particular task can be completed by:

    • User to which it was assigned.
    • User to which the possibility of task completion was delegated by user to which the task is assigned.
    • Member of the user group to which to task is also assigned.
    • By ObjectGears instance Administratorem.
    • Automatically by system, if another task created within the same activity Task was completed and if the activity has set the option First processing cancels the other tasks (see below).


    Tasks within one workflow need to be uniquely identified in order task data can be read/entered. This is ensured by the Code. Therefore, enter a unique code for each task within one workflow.


    Category is used for identification of same tasks over differnt workflows. Category is displayed on the page with tasks, where the user may filter the same category. This helps to prioritize or focus e.g. on category "Security", "Access rights" etc.

    Complete within days

    Value for calculation of the task deadline.

    There is column Planned completion date on the page with tasks, where calculated value of the last completion date is displayed (creation date + Complete within days). This columns is highlighted by a background colour according to the number of days reamining till the Planned completion date:


    Colour Description
    black If the task is more than 3 days after the deadline.
    red If the task is already after the deadline.
    yellow If there are less than 3 days till the deadline.

    The colour is set according to the first condition met.


    This option facilitates definition of the action after the task is completed by the user. If the task is assigned to more users and one of them completes it, workflow may continue or may wait till tasks to other users are also completed. For simple situations two options in this property may be used. For more complex situations Script after user entry shall be used.

    Option Description
    After record save: First processing cancels the other tasks Once the first user completes the task, all other tasks }of the same activity] are cancelled and workflow continues.
    After record save: process all the tasks Workflow continues only when all the users complete the tasks.

    If there is an option for approval or rejection of the task subject defined in the class you have to create your own script responding to the user input that will cancel other tasks and perform other necessary actions.

    Send a default mail after creation

    When checked off users that were assigned a task will receive a short informatory e-mail about the task (localization according to the recipient language):


    Task '__task_name__' was asigned to you


    Task '__task_name__' was assigned to you.
    Deadline: __date__
    Link: __www_link__

    Initialization script

    After task creation there are no values or default values entered in the definition of columns in the task class. If you need to set other values you can do that in this script.

    You have support of these objects in the script:


    Object Description
    OG General approach for ObjectGears objects.
    OGWFActualRun Special object for the current running workflow.

    In order to set a property of a new task use property OGWFActualRun.ActualTask.

    In order to set users, to which the task shall be assigned use property OGWFActualRun.ActualTaskAssignTo and/or OGWFActualRun.ActualTaskAssignGroupTo. You can assign tasks from one activity Task to an unlimited number of users.


    \\Create two tasks. One to user novakp anad to user veselam. Both tasks can be completed also by members of the user group Id = 1.
    OGWFActualRun.ActualTaskAssignTo.Add( OG.Person.GetByAccount( 'novakp'));
    OGWFActualRun.ActualTaskAssignTo.Add( OG.Person.GetByAccount( 'veselam'));
    OGWFActualRun.ActualTaskAssignGroupTo  = 1;

    Script after user entry

    Script in this property is started whenever a user completes a task. You can decide here if workflow shall continue or wait till processing all the tasks. You can use a list of all the tasks generated by this activity (OGWFActualRun.TasksByActualActivity). You can also read the values entered by the user and work with them further (e.g. store them in workflow properties).

    You have support of these objects in the script:


    Object Description
    OG General approach for ObjectGears objects.
    OGWFActualRun Special object for the current running workflow.