1. Script for condition

    Article: AN0001903Updated: 22.10.2019

    Condition can be an example of a simple script. We define it e.g. in rules Condition or Send notification.

    If we want to send the given notification just in case when a column with solver is modified, we will use following condition. (Column with solver has the code 'solver'.)

    OGActualDataRow.IsChange('solver')

    Below script defines a condition when column with code 'status' contains value 3.

    OGActualDataRow['status'] == 3

    Previous example will be used in case of column referring to another class, in which we have particular statuses. In order to ensure portability we should rather use a condition using code of the referred record, not its Id. In our example the condition is true if the record refers in column 'status' to a record that contains in column 'code' value 'closed'.

    OG.Column.GetByCode( OGActualDataRow, 'status') == 'closed'

    Condition when columns with code solver has to contain current user.

    return OG.IsNull(OGActualDataRow['solver'], -2) == OG.Person.GetLoginPerson().Id;

    Following condition can be used in rule before saving a record if we want to ensure that a record in status 'closed' will be saved only if column 'resolution' is filled in.

    (OG.Column.GetByCode( OGActualDataRow, 'status') == 'closed') && (OGActualDataRow['resolution'] == null)

    Following condition in a rule for sending an email gets activated once there are only two days left till the value in the column 'end_date'.

    OGActualDataRow['end_date'] < OG.DateTime.Now.AddDays(2)

    We will use the following condition if we want to send an email or perform another action only if the record was in status 5 or 6 and after saving it is in another status.

    (OGOldDataRow['status'] == 5 || OGOldDataRow['status'] == 6) &&
    OGActualDataRow['status'] != 5 && OGActualDataRow['status'] != 6

×