1. Setting up record value

    Article: AN0002403Updated: 09.05.2021

    We can set values in a record simply by means of rules Before new record save or After existing record save. We choose Action type Set or calculate value, define a condition and define values that should be saved. However, ObjectGears enables to define only one rule with this action type at a new record and one at an existing record.

    If we want to define various values depending on values in other columns we choose Action type: Start a script. Then we define conditions and value settings in the script.

    Below script will set the status of the record to value 4, if there was a change in column 'resolution_type' and this column is not null. If this condition is not met, the status is set to 2, if the column 'approval' was changed and it contains value 1 now or status of the record is set to 3, if the column 'approval' after change contains value 2.

    if (OGActualDataRow.IsChange('resolution_type') && OGActualDataRow['resolution_type'] != null)
    {
      OGActualDataRow['status'] = 4;
    }
    else if (OGActualDataRow.IsChange('approval') && OGActualDataRow['approval'] == 1)
    {
      OGActualDataRow['status'] = 2;
    }
    else if (OGActualDataRow.IsChange('approval') && OGActualDataRow['approval'] == 2)
    {
      OGActualDataRow['status'] = 3;
    }

    Setting a column for current date and time:

    OGActualDataRow['sla_start'] = OG.DateTime.Now;

×