In OmniPlan 4.0.2 (v205.7.0) reading Task.duration
fails.
Writing works well – we can set a task’s duration, and the results are visible in the GUI, but as a getter, evaluation of .duration
invariably returns only null values, even for tasks that do have duration values.
(regardless of whether these durations have been set through the GUI or the API)
Example:
We can create the following data by script or GUI, but the .duration
value for each task is invariably reported to be null
const test = () => {
const
rootTask = document.project.actual.rootTask;
[1, 2, 3, 4, 5].forEach(
h => {
const newTask = rootTask.addSubtask();
newTask.title = h.toString() + ' hours';
// WRITE/SET SUCCEEDS
newTask.duration = Duration.workHours(
2 * h
);
}
);
// READ/GET FAILS
return rootTask.subtasks.map(
task => null === task.duration
);
//-> [true, true, true, true ...] :-(
}