Send Email Notification with Scheduled Job

Alex23
Kilo Guru

Hi All,

I have a requirement to send an email notification on a certain day of the month. I am trying to achieve this through an event using a scheduled job.

This is what I have so far in Dev to test this -

Event

find_real_file.png

Scheduled job

find_real_file.png

Notification

find_real_file.png

find_real_file.png

 

I believe the issue is with the script for the scheduled job?

Or is there a different/easier way to achieve this?

Any help would be much appreciated.

Thanks,
Alex

1 ACCEPTED SOLUTION

Okay. Then do it like this in your scheduled job.

var gr = new GlideRecord("incident");

gr.setLimit(1);

gr.query();

if(gr.next()) {

gs.eventQueue('patching_email',gr,gs.getUserName(),gs.getUserID());

}

Event/notification runs on a specific record. Since in your case, its just a static mail.. we just pass any 1 incident object. Hence using setLimit(1).

View solution in original post

18 REPLIES 18

Thanks for your response.

I tried the 2nd code as it is not specific to any condition/query but it did not work, any further ideas?

Thanks again,
Alex

asifnoor
Kilo Patron

Hi Alex,

Few things

1. gr is not declared anywhere. Thats the 1st issue as others already pointed out.

2. in your notification you selected event param2 contains recipient. Technically to which user you want to send mail whenever this event is fired? 

 

Hi,

Thanks for you response.

I would like to send the email to whoever is selected in the 'when to send' tab within the notification?

Any Ideas?

Thanks,
Alex

Hi Alex,

I assume you meant recipient selected under who to receive tab.

In that case, you can uncheck Event2 param contains recipient checkbox.

And on that specific day What notification you are planning to send? Are you including any details about any incidents? Or is it just a static email that you send without any details of any incident?

Hi there,

It is just a static email.

Thanks!
Alex