1. Activity Condition

    Article: AN0001925Updated: 23.09.2018

    The Activity Condition decides whether certain expression is true and based on that the workflow continues with a branch marked as Yes/True or No/False.

    The condition can be represented by a simple expression like in the first example or the Condition can contain multi-line script e.g. reading data from various classes. In the latter case the script has to contain command return followed by an expression that can be evaluated as True/False.

    Below examples are real-life conditions from solutions Access Rights and Knowledge Base that are included in the package ObjectGears with models.

    Comparing with workflow property

    Below script will find out, whether workflow property 'application-gestor-approval' contains value Yes/True.
    Where to use the script: Workflow Activity Condition

    OGWFActualRun.Property.GetBoolean( 'application-gestor-approval') == true;

    Finding out whether approver exists

    Below script will find out, whether there is approver defined in the record with which the workflow was started. It returns Yes, if an 'approver' exists and No, if it does not exist.
    Where to use the script: Workflow Activity Condition

    \\Storing column in a variable.
    var colApprover = OG.Column.GetByCode( OGWFActualRun.InputDataRow, 'approver');

    \\Returns True, if the value in column is not null and False, if it is null.
    return OGWFActualRun.InputDataRow.GetPerson( colApprover .Id) != null;

    Finding out whether it is a request for deletion

    Below script will find out, whether the request (record, with which the workflow was started) is marked in column 'request for deletion'. It returns Yes, if it is such a request, and Not, if it s not.
    Where to use the script: Workflow Activity Condition

    \\Storing column in a variable.
    var colDel = OG.Column.GetByCode( OGWFActualRun.InputDataRow, 'request_for_deletion');

    \\Returns True, if the value in the column is true and False, if it is not.
    return OGWFActualRun.InputDataRow.GetBoolean( colDel.Id) == true;

    Finding out whether it previous task was approved

    Below script will find out, whether task with code 'Article update' was approved. It returns Yes, if it was apporoved, and No, if it was not. There is value 1 in the column after approval.
    Where to use the script: Workflow Activity Condition

    \\ Finding out the given task and column
    var task = OGWFActualRun.Tasks.GetTasksByActivityCode( 'Article update');
    var colApp = OG.Column.GetByCode( task[0].DataRowParentId, 'approval');

    var dr = OG.WorkflowSeq.GetDataRowFromTask(task[0]);
    var id = dr.GetClassLink( colApp.Id);
    return ( id != null && id == 1);

    // 1 - approve
    // 2 - reject

×