A small customization I have been recently asked for is to automatically calculate Job Plan duration from Tasks.
This can be easily achieved with an automation script on the JOBTASK object.
Open the Automation Scripts application and create the following Script with Object Launch Point
- Launch Point: MXDJPDURATION – Automatically calculates Job Plan Duration from Tasks
- Event: Save Add,Insert,Delete – Before Save
- Script: MXDJPDURATION – Automatically calculates Job Plan Duration from Tasks
- Language: Python
Script
#----------------------------------------------------------------
# Script: MXDJPDURATION
# Launch Point: JOBTASK - Save Add,Insert,Delete - Before Save
# Automatically calculates Job Plan Duration from Tasks
#----------------------------------------------------------------
jpMbo = mbo.getOwner()
if jpMbo and jpMbo.getName()=="JOBPLAN":
totalDuration = 0
jptaskSet = jpMbo.getMboSet("JOBTASK")
jptask = jptaskSet.moveFirst()
while (jptask):
# add task duration only if task is not marked for deletion
if not jptask.toBeDeleted():
totalDuration = totalDuration + jptask.getDouble("TASKDURATION")
jptask = jptaskSet.moveNext()
jpMbo.setValue("JPDURATION", totalDuration)
Automatically calculate Job Plan duration from Tasks
That’s great, have you got something equivalent for workorders?