How to trigger email notification from scheduled job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 01:31 AM
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 login | Days since login | Send Email | Create Inc | Update Inc |
Aug 2 | Aug 1 | 1 day | No | No | No |
Aug 31 | Aug 1 | 30 day | Yes | No | No |
Sep 5 | Aug 1 | 35 day | Yes | No | No |
Sep 20 | Aug 1 | 50 day | Yes | Yes | Yes(if condition met) |
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2024 03:04 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 09:01 PM
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'.