# Expression NOW() not working DF 2.2

**URL:** <https://community.dreamfactory.com/t/expression-now-not-working-df-2-2/2845>\
**Category:** Connecting to SQL\
**Created:** [June 14, 2016, 6:15pm UTC](https://community.dreamfactory.com/t/expression-now-not-working-df-2-2/2845 "2016-06-14T18:15:30Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![paulo.hgf1408](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/paulo.hgf1408/32/751_2.png) [@paulo.hgf1408](https://community.dreamfactory.com/u/paulo.hgf1408)\
**Post date:** [June 24, 2016, 3:02pm UTC](https://community.dreamfactory.com/t/expression-now-not-working-df-2-2/2845/8 "2016-06-24T15:02:11Z")

</div>

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:

```auto
// 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?](https://community.dreamfactory.com/t/how-to-assign-the-current-user-id-to-post-api-in-dreamfactory/2236/4?u=juniorconte)

---

_[View the full topic](https://community.dreamfactory.com/t/expression-now-not-working-df-2-2/2845)._
