- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2021 01:32 PM
I am creating a scheduled for records that are created 30 days ago and 14 days ago and then it triggers an event that sends out a notification but i can't get quite the right syntax any ideas? TIA I don't think this is right...
var gr = new GlideRecord('u_pc_reclamation');
gr.addQuery('sys_created_onONLast 30 days@javascript:gs.beginningOfLast30Days()@javascript:gs.endOfLast30Days()^active=true');
gr.query();
while (gr.next()){
gs.eventQueue("pc_reclamation_30days", gr, gr.requested_for);
gs.log('Email Sent: ' + gr.number + " requested for " + gr.requested_for);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2021 01:37 PM
Hi Wendy,
That's an EncodedQuery, not an addQuery.
So you'd want to change that to:
gr.addEncodedQuery('paste_query_here');
And so the paste query here would be best to take from the table list of these records, filter them like you want, then right-click the last piece of the breadcrumb and choose "copy query".
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2021 01:37 PM
Hi Wendy,
That's an EncodedQuery, not an addQuery.
So you'd want to change that to:
gr.addEncodedQuery('paste_query_here');
And so the paste query here would be best to take from the table list of these records, filter them like you want, then right-click the last piece of the breadcrumb and choose "copy query".
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2021 11:50 AM
I think she is looking for what the syntax would be. I believe you could do a datetime and get the current date, and then do a less than from the current date

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2021 12:00 PM
Hello,
Sorry, not sure what you mean by your response.
I replied 10 months ago to this and the author has marked it as Correct, which means it satisfied what they were asking for.
Perhaps re-read my reply and try it yourself and see what you think?
The syntax is derived from the method I posted...
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!