Auto populate Current Date time in a field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 11:30 AM
Hello,
I have a requirement to autopopulate current date time a field when we click on a link in the notification, I am trying to generate the URL using below:
Click Here: ${URI+&sysparm_begin=gs.nowDateTime()} but this is just not giving me anything.
Any suggestions on how we can achieve this, Please share your thoughts on this one.
- Labels:
-
Notifications

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 11:34 AM
Try this and see if it works
${URI+&sysparm_begin=ONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday()}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 11:47 AM
Hello,
I have tried your code still it is not setting any value in the field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 12:56 PM
Hi,
Write a notification mail script like below and include that in your notification.
Name: printDateTime
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var currDate = gs.nowDateTime();
template.print('<a href="' + gs.getProperty('glide.servlet.uri') + '&sysparm_begin='+currDate+'">' + 'Click Here111' + '</a>');
})(current, template, email, email_action, event);
Then in your notification, wherever you want that link, simply call like this
${mail_script:printDateTime}
I checked in my dev instance and it is generating the link with the date and time correctly.
Mark the comment as a correct answer and also helpful once worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2019 01:13 PM