Recurring task based on previous date

cmschelin
Kilo Contributor

So, I have a CMDB record that has a date field in it in the future. I want to have a task to review the record 30 days before that date. Is there a way to have a ticket be automatically generated?

 

(An example use of this is a certificate that expires in, say, June -- I want a ticket fired off in May that says "review/renew certificate".)

3 REPLIES 3

lauri457
Tera Sage

There is a certificate management application sn_disco_certmgmt that you might be entitled to if you are already discovering certificates.

More generally a simple way to is a scheduled script execution and something like

Run: daily

var certGr = new GlideRecord("cmdb_ci"), certTask = new GlideRecord("task")
certGr.addEncodedQuery("datefieldRELATIVEGT@dayofweek@ahead@29^datefieldRELATIVELT@dayofweek@ahead@31^ORDERBYname")
certGr.query()
while (certGr.next()) {
	certTask.newRecord()
	certTask.insert()
}

 

 

Ankur Bawiskar
Tera Patron

@cmschelin 

ServiceNow provides OOTB Data Certification task but it relies on static filter and conditions

For your case you will require daily scheduled job and check today's day and that due date is 30 days apart, if yes then create a task

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@cmschelin 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader