- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 08:51 PM
Hello,
I have a date and time variable on the RITM that I need to check to see if it is empty or not.
I tried this code in email script, but it is not working: Thank you
if (current.variables.startDate.nil()) {
template.print('Date is invalid);
} else {
template.print('Date is valid);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 11:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2023 08:59 AM
Hi @Jessica28
In mail script you already have the current object using which you can dot walk to RITM table, no need to do GlideRecord on RITM table.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2023 09:16 AM
Your code below is working out perfectly. I will replace my version with yours. Awesome, I learned something new today. Thanks to you and the other helpers.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var date=current.sysapproval.variables.select_end_date_time.getDisplayValue();
var msg="Date is not valid"
if (date)
{
msg='Date is valid';
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 11:15 PM
Thank you so much for your help. I think I got it working now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2023 11:25 PM
Glad to know.
Please close the thread by marking your own response as correct.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader