Send reminder notification to the owner of asset after 14 days after initial email was sent

Shantanu_99
Tera Contributor

Hi All,

 

I have one requirement. If LastBootTime is greater than 90 days on computer CI then send notification to the owner of computer asset (Assigned To). For this I have created scheduled job (Run Daily) and added query LastBootTime relative before 90 days ago and triggering notification through event.

 

Next requirement is when first notification is sent for one computer (like on 91th day or 92, 93, 94 day etc).

Then Reminder notification will be send on after 14 days of initial first email was sent if LastBootUp time is not updated.

 

How to write this logic in the below script.

 

var gr = new GlideRecord('cmdb_ci_computer');
gr.addEncodedQuery('u_lastbootuptimeRELATIVELT@dayofweek@ago@90^sys_class_name=cmdb_ci_computer');
gr.query();
while(gr.next()){

gs.eventQueue('boot.computer',gr,gr.assigned_to);
}

 

Thanks & regards,

Shantanu B

 

 

 

1 REPLY 1

Mark Manders
Mega Patron

Use a flow, it will make it so much easier.

You can just put in wait conditions. At 90 days you send the first notification, another wait for 14 days after that and a check on the reboot date to send the next notification.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark