Please follow this guide to add your script:
* Note: the following steps only apply to independent fields. Subtable fields cannot be set up this way.
Right-click on any of the application tabs or sheets and select Javascript Workflow or Global Javascript Workflow, which will take you to the Workflow Module.
function setLastModifiedOnField(pathSheet, observeField, recordField) {
if (param.getOldValue(observeField) !== param.getNewValue(observeField) ||
param.isCreateNew()) {
var today = new Date(new Date().getTime() + account.getTimeZoneOffset());
function pad2(n) { return n < 10 ? '0' + n : n }
var fmtValue = today.getFullYear() + "/" +
pad2(today.getMonth() + 1) + "/" +
pad2(today.getDate()) + " " +
pad2(today.getHours()) + ":" +
pad2(today.getMinutes()) + ":" +
pad2(today.getSeconds());
var query = db.getAPIQuery(pathSheet);
query.addFetchDomains(recordField);
var entry = query.getAPIEntry(response.getRootNodeId());
entry.setFieldValue(recordField, fmtValue);
entry.save();
}
}
If your sheet URL is https://www.ragic.com/accountname/tabname/1
And
The field whose last modification date & time you’d like to generate is "Active Status" (field ID 1003114), and the field where you’d’ like to record last modification date & time of field "Active Status" is "Last Edit (status)" (field ID 1003115).
Add this to the Post-workflow:
setLastModifiedOnField("/tabname/1", 1003114, 1003115);
Don't forget to save your changes.
(The populated date & time value is based on the timezone set in your Company Setting.)
*Please note that when creating a new entry, the last modification date & time will be auto-generated after saving even if the the specific field is not filled. If you wish to keep the last modification date & time empty in this case, you can replace with below script in your Post-workflow:
if(param.getOldValue(1003114) !== null || param.getNewValue(1003114) !== "" ){
setLastModifiedOnField("/tabname/1", 1003114, 1003115);
}