What is the Syntax for Created 30 days ago

Wendy Peterson
Giga Guru

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);
   }
1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

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".

find_real_file.png

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

3 REPLIES 3

Allen Andreas
Administrator
Administrator

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".

find_real_file.png

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

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

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!