How to trigger email notification from scheduled job

Deepa12
Tera Contributor

Hi,

Please help me to create scheduled job to trigger email notification and incident:

Table name = cmdb_ci_computer

o If (today – Computer last login date) = 30 or 35
 Trigger email notification event XXXXX

 Notification email body:

Computer name                            Last Login                   Description  


TEN-0B29YTV3-LB                   1/18/2024        Harper, Kristi - Intern_Sarah_Godfrey - [Latitude 5430:B29YTV3]

 

Once the computer reaches 40 days inactive, it will be quarantined from the network.

After 50 days, this computer must be brought back to Local IT Support for restaging and network access. To avoid this, please log into the computer and make sure that it connects to the network.

 

o If (today – Computer last login date) = 40
Create incident

o If (today – Computer last login date) = 50
Check for active incident that matches this criteria:
• Incident CI = sys ID of Ci being checked in scheduled job

 

o Example to show when email will be generated an incident created/updated

Run date Last loginDays since loginSend EmailCreate IncUpdate Inc
Aug 2 Aug 11 dayNoNoNo
Aug 31Aug 130 dayYesNoNo
Sep 5Aug 135 dayYesNoNo
Sep 20Aug 150 dayYesYesYes(if condition met)


Thanks.

2 REPLIES 2

Najmuddin Mohd
Mega Sage

Hi @Deepa12 ,

From the scheduled job, you can trigger an event and send the parameters from the event to the notification.
Check gs.eventQueue() function.


If the above information helps you, Kindly mark it as Helpful and Accept the solution.

Regards,
Najmuddin.

AnciaminneM
Tera Contributor

 In the scheduled job , based on the different conditions , you can trigger different events . Events can be called in the scheduled job gs.eventQueue(), you can pass parameters as per the different conditions. In the notification, you can configure when to run as 'event triggered'.