The web blog strives to be a comprehensive guide to SCCD, TADDM, SERVICE NOW and MAXIMO tools. This is a personal site maintained solely by me. I intend to update it regularly.For live updates please follow us on.

Automation Script(Jython) - Calaculate Actual Spent Time-Service Request Application

Calculate Actual Spent Time-Service Request

from psdi.util.logging import MXLogger
from psdi.util.logging import MXLoggerFactory
from psdi.mbo import MboConstants

#print "Calculate Duration"

#Log for debugging
#logger = MXLoggerFactory.getLogger("maximo.script");
#logger.debug("ScriptName" + launchPoint)

actual_start = mbo.getDate("ACTUALSTART")
actual_finish = mbo.getDate("ACTUALFINISH")
if (actual_start is not None and actual_finish is not None):
    actual_duration = (actual_finish.getTime() - actual_start.getTime())/3600000.0
    mbo.setValue("ACTDUR", actual_duration,MboConstants.NOACCESSCHECK)

#print "End Calculate Duration"