- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2022 06:57 AM
Hi There!
Basic question.
Say i read this link https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0827366 for scheduled email report.
and there is this script in the KB (no errors)
How can i test this script in my servicenow to check for output? i googled around, some say use "scripts - background" (https://<instance>.service-now.com/sys.scripts.do)
However the output is blank, it should return true or false so that i could check what is the return..
Or is there a better way to test script for the output?
Thanks!!!!
// This condition should cause the scheduled report to only run on a Tue, Wed and Fri)
// 0=Sunday,1=Monday,2=Tuesday,3=Wednesday,4=Thursday,5=Friday,6=Saturday
var d = new Date();
dayOfWeek = d.getDay();
if(dayOfWeek == 2 || dayOfWeek == 3 || dayOfWeek == 5) {
answer = true;
}
else {
answer = false;
}
Run:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2022 07:33 AM
Hi Max,
Replace answer = true; with gs.print('true');
Replace answer = false; with gs.print('false');
Hopefully this will at least print true/false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2022 07:33 AM
Hi Max,
Replace answer = true; with gs.print('true');
Replace answer = false; with gs.print('false');
Hopefully this will at least print true/false.