How to create Email Notification Through Scheduled Jobs

Juhi Jha
Tera Contributor

How to create Email Notification Through Scheduled Jobs

1 ACCEPTED SOLUTION

Prasad Dhumal
Mega Sage
Mega Sage

1) Register an Event in Event Registry.

2) Configure Scheduled job > According to your requirement

3) use gs.eventQueue() in Scheduled jobs script. refer this article to know more about it gs.eventqueue - Developer Community - Question - ServiceNow Communityfind_real_file.png

4) Configure Notification > in 'When to send' Select 'Send when' to Event is fired. and choose the event name.

5) In 'Who will receive'  select appropriate user whom you want to send notification.

6) In What it will contain, mention your email body and subject.

View solution in original post

4 REPLIES 4

AirSquire
Tera Guru

Register a custom event. Trigger that event from scheduled job and setup a notification on that event.

Regards
Air

Navigate to: System Policy > Events > Registry to register a new event.

From the scheduled job you can use the gs.eventQueue(); APi URL

For configuring the notification, in the 'send when' field under when to send section, you will find the option to select the event on which to run. The event parameters can be used in the mail scripts.

Regards
Air

Prasad Dhumal
Mega Sage
Mega Sage

1) Register an Event in Event Registry.

2) Configure Scheduled job > According to your requirement

3) use gs.eventQueue() in Scheduled jobs script. refer this article to know more about it gs.eventqueue - Developer Community - Question - ServiceNow Communityfind_real_file.png

4) Configure Notification > in 'When to send' Select 'Send when' to Event is fired. and choose the event name.

5) In 'Who will receive'  select appropriate user whom you want to send notification.

6) In What it will contain, mention your email body and subject.

priyanshij
Kilo Guru

1. Create a new event using System Policy > Events > Registry

2. Create a new Scheduled Job as per the frequency requirement and trigger the event using the function

    gs.eventQueue

3. Create a new Notification and in "when to send" and "Send when" select event is fired