two Fileds type are Date/Time and but mttr fields type is duration type then how to calculate mttr

sangitak
Tera Contributor

two Fileds type are Date/Time and but mttr fields type is duration type then how to calculate mttr based on created and resolved. i try to do below is the code: but i am getting output in datetime value but i want output value mttr in duration . If anyone know Please assit me on this issue.

 

 var mttr = GlideDateTime.subtract(new GlideDateTime(current.getValue('resolved_at')), new GlideDateTime(current.getValue('sys_created_on')));
    var difference = new GlideDuration(mttr);
    current.u_rpt_mttr = difference;
    gs.log("Resolved date" + current.getValue('resolved_at'));
    gs.log("Created date" + current.getValue('sys_created_on'));
    gs.log("Mttr Timing" + current.u_rpt_mttr);
    current.update();
0 REPLIES 0