Encoded Query String not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2020 08:32 PM
Hi Everyone,
Seeking your help please. I have created a notification triggered by an event. I intended to schedule the job to run daily.
Unfortunately it seems that my script where unable to grab the records using the query I provided which is got after I filter the record whose end date is today. Please see my script below:
var rec = new GlideRecord('resource_plan');
rec.addEncodedQuery('state=3^end_dateONToday@javascript:gs.beginningOfToday()@javascript:gs.endOfToday');
rec.query();
while (rec.next()){
gs.eventQueue("resourceplanend.now", rec);
}
Thanks in Advance!
- Labels:
-
Script Debugger
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2020 11:00 PM
Hi Mark,
So are you saying the row count is proper 1; but email not triggered?
In the eventQueue() you are not setting any recipient in 3rd parameter? to whom email needs to be sent?
Can you share screenshot of email notification? when to send and who will receive tab?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2020 11:24 PM
Hi
Didi you try your script in Scripts Background, if it will return your desired records?
Let me know, please.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2020 07:13 AM
Hi Dirk,
Note sure what happen but the code I sent you works. Maybe there are some hidden characters that was added since I paste it to a note editor on my MAC.
Thanks Guys
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2020 07:24 AM
Hi Mark,
Please consider marking appropriate reply as ✅Correct & 👍Helpful.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2020 09:42 AM
Hi Mark
Glad to hear that you managed to solve your issue.
Thanks for the feedback
Have fun
BR
Dirk