Help

Re: Button & Scripting Block - Date/Time Field

3033 1
cancel
Showing results for 
Search instead for 
Did you mean: 
McKenna_Johnson
5 - Automation Enthusiast
5 - Automation Enthusiast

I am looking for a script to insert the current date and time into a field when you hit a button.

Currently, my users just hit the “Today” button when the calendar pops up in the date-time field when they begin a task but I would like to just have a “Start Task” button.

I am new to scripting and would appreciate it if someone could walk me through this first application.

12 Replies 12

Is it possible to tweak this a hair and have it add seven days to todays date and set the new date to that?

@Michael_Ali1 You could just replace the last three lines of the original script with the following four:

let record = await input.recordAsync('Record to timestamp', config.tableToUse)
let newDateTime = new Date();
newDateTime.setDate(newDateTime.getDate() + 7);
await config.tableToUse.updateRecordAsync(record, { [config.timeStampField.name]: newDateTime })

Thats perfect. Thanks!