rrrrrrrrr
rrrrrrrrr

Reputation: 222

what's the way to get Timestamp in Google App maker?

I have a form. User fill up the form. which saves the data and send email. The datasource is in manual save mode. I was trying to save timestamp when the user use the form & send email. Then sort the data using the Timestamp field. I have a number field called Timestamp.(Tried using date field too) I'm saving the data as

OnBeforeSave :: record.Timestamp = Date.now();

But It's not saving the time. I'm not getting any error, but when I try to see it in table of data. The field is empty. what am I doing wrong??
Let me know If you need anything else.

Upvotes: 1

Views: 122

Answers (1)

rrrrrrrrr
rrrrrrrrr

Reputation: 222

Realization:: whenever the datasource is in manual save mode you have to call

datasource.saveChanges();

every time you want to save something. I have added

app.datasources.DataSourceName.item.DateValue = Date.now().toString();
app.datasources.DataSourceName.saveChanges(); 

in my client script. Solved the problem. N.B. - I have added toString() because I wanted to save my TimeStamp value as a string.

Upvotes: 3

Related Questions