I have a status column for the stage a project is in.
I tried using automation to record todays date when a stage is changed. However this is problematic as sometimes people select wrong stage for a split second and the system records that date. I explored having automation overwrite that date, but it still creates problems either route I go. So I would like to safeguard it by forcing user to click the button field next to the status field to confirm/submit.
So the idea is they select status they are starting today, and click the button. The script should then check the status field, and based on that value record todays date in the corresponding “actual date” field.
Is someone able to modify the below script to give a baseline of how/where I can enter the multiple status options it might find and the corresponding date fields to record to?
const config = input.config({
title: "Timestamp with Button",
description: "Use the associated Button field to fill Timestamp field with current DateTime.",
items: [
input.config.table('tableToUse', {
label: 'Table to Use'
}),
input.config.field('timeStampField', {
label: 'Field to fill with current DateTIme',
parentTable: 'tableToUse'
})
]
})
let record = await input.recordAsync('Record to timestamp', config.tableToUse)
let currentDateTime = new Date()
await config.tableToUse.updateRecordAsync(record, { [config.timeStampField.name]: currentDateTime })