Compare "Last Scanned" and "Install Date" on cmdb_sam_sw_install table

othomas1
Kilo Guru

Hello everyone!

I am trying to create a business rule that compares the "last scanned" and "install date" fields, whatever records that are found to be 90 days older than the newest date in the install column, those should be deleted.

 

find_real_file.png

 

Script that i started:

 


var gr = new GlideRecord('cmdb_sam_sw_install');
gr.query();

while(gr.next()) {


var gdt1 = new GlideDateTime("last_scanned");
var gdt2 = new GlideDateTime("install_date");
var dur = new GlideDuration();

var dur = GlideDateTime.subtract(gdt1, gdt2); //the difference between gdt1 and gdt2
gs.print(dur.getDisplayValue());


}

 

Is it possible to compare a date field with a date/time field? If so, is there another thread in the community i can reference?

 

Any information is appreciated!

26 REPLIES 26

AbhishekGardade
Giga Sage

Hello Othomas,

Any update on it?

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thank you, Abhishek

Thank you,
Abhishek Gardade

Hello Thomas,

Is your issue resolved?

Thanks,

Abhishek

Thank you,
Abhishek Gardade