- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 02:18 AM
We have a solution in App Engine for our onboarding team to process cases, on which we have a set of "checks" fields, mostly checkboxes:
We have a current mechanism in "flow" to trigger when an Agent marks a check as complete to time/date stamp and add their name.
While this works "okay", I've found that flow triggers can be a bit "hit-and-miss", insofar, as sometimes the timestamps don't populate after a save.
I would like to make this a little more robust with an "on-change" Client Script to auto-populate the date/time and Agent name.
Is this possible?
I'm not the greatest in Javascript, so any suggestions would be very much appreciated.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 03:48 AM
you can use onChange client script on each of those checkboxes
Sample script for 1 is like this, please enhance
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue == '')
g_form.clearValue('yourField');
if (newValue.toString() == 'true') {
var today_date = new Date();
var today_date_time_str = formatDate(today_date, g_user_date_time_format);
var name = g_user.firstName + ' ' + g_user.lastName;
g_form.setValue('yourField', today_date_time_str + " " + name);
}
}
Another alternative is to use before update business rule and check which checkbox got checked and only update that field
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 03:48 AM
you can use onChange client script on each of those checkboxes
Sample script for 1 is like this, please enhance
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if (newValue == '')
g_form.clearValue('yourField');
if (newValue.toString() == 'true') {
var today_date = new Date();
var today_date_time_str = formatDate(today_date, g_user_date_time_format);
var name = g_user.firstName + ' ' + g_user.lastName;
g_form.setValue('yourField', today_date_time_str + " " + name);
}
}
Another alternative is to use before update business rule and check which checkbox got checked and only update that field
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 04:05 AM
Wonderful! Works perfectly. Thanks, as always, Ankur!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2025 04:20 AM
Glad to help.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader