How do I prevent users from putting an earlier tim...
# general
i
How do I prevent users from putting an earlier time in NetSuite's custom Time field? Hello, Please is it possible to restrict user from entering an earlier time in a netsuite field?
n
It is possible by using client script.
i
Please can you provide an example?
I use the following script to prevent user to enter an earlier date`function validateField(scriptContext) {` var curRec = scriptContext.currentRecord; var fieldName = scriptContext.fieldId; if (fieldName === 'custrecord_date_souhaitee') { //replace "date" with your field id var recDate = curRec.getValue({fieldId: fieldName}); var today = new Date(); if (recDate < today){ alert('Vous ne pouvez pas entrer une date antérieure à la date du jour'); curRec.setValue({ fieldId: 'date', value: null }); } }
But I don't really know how to achieve the same thing for the time