Expression NOW() not working DF 2.2

palliation I’m using events scripts to include the time and date of the server in the fields on events post, patch and put.

this code bellow is a example:

// POST /api/v2/service_db/_table triggers script service_db._table.{table_name}.put.pre_process
// This script runs BEFORE records are written to the service_db.
// records are in array event.request.payload
var _ = require('underscore-min.js')._;

function tableContainUpdatedAt(tableName) {
    var schema = platform.api.get('db-servicos/_schema/' + tableName);

    return _.chain(schema.content.field)
        .pluck('name')
        .indexOf('updated_at')
        .value() > -1;
}

if (event.request.payload && tableContainUpdatedAt(event.resource)) {

  if(event.request.payload.resource.length) {
    _.each(event.request.payload.resource, function(record) {
        record.updated_at = new Date().toISOString();
    });
    
    event.request.content_changed = true;
  }
}

PS: its code based of post: How to assign the current user id to post api in dreamfactory?

2 Likes