1. Creation of workflow task

    Article: AN0001930Updated:

    Přiřazení workflow úkolu řešitelům

    Following script will assign two tasks to particular users. Both tasks can be also completed by members of the group to whch they are also assigned to.
    Where to use this script: Workflow task Activity: Script for initialization

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

    Adding information to the task

    In some cases we may include in the task also information to other columns that we have created in the class with tasks. We will include in the above scrit also calling function 'SetInstruction' defined in the script block 'instruction'. 

    Where to use this script: Workflow task Activity: Script for initialization

    //#block instruction
    \\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;
    SetInstruction( 'INS_0010', OGWFActualRun.ActualTask, OGWFActualRun.ModelId);

    We pass to the function the parameter (in particular activity e.g. 'INS_0010', that determines record code from the class 'task_instructions', from which values are copied from defined columns to columns in the class with tasks.

    Where to use this script: Script block

    function SetInstruction( instructionCode, taskDataRow, modelId)
    {
    //read dr with instruction
    var m = OG.Model.GetById(modelId);
    var instDr = OG.DataRow.GetDataRowByCode( null, m.ClassDefs['task_instructions'], instructionCode);

    taskDataRow['description'] = instDr['description'];
    taskDataRow['name'] = instDr['name'];
    taskDataRow['report'] = instDr['report'];
    }

    Reference from task to another record 

    Alternatively, we can refer from the task to a record with detailed infromation.

    Following script will add to the task to column Id=6465 reference to record Id according to the workflow property 'request-id'. It can be e.g. Id of the request with which the workflow was executed.

    Where to use this script: Workflow task Activity: Script for initialization

    //*Adding reference to Request into the Task
    OGWFActualRun.ActualTask.SetClassLink( 6456, OGWFActualRun.Property.GetInteger( 'request-id'));

    Example of task with a record referred in tab tab Request.

×