Encoded Query String not working

mark141230
Tera Expert

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!

 

11 REPLIES 11

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

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi

Didi you try your script in Scripts Background, if it will return your desired records?

Let me know, please.

BR

Dirk

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

Hi Mark,

Please consider marking appropriate reply as Correct & 👍Helpful.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Mark

Glad to hear that you managed to solve your issue.

Thanks for the feedback

Have fun

BR

Dirk