Dependencies
When a task must be completed before another can begin, a dependency exists between them. Charting dependencies in your project is a key part of understanding the critical path of tasks that leads through to its successful completion, on time and within budget.
Using the Gantt chart in Task View, you can represent the relationships between tasks with dependency lines. A dependency line is drawn from the beginning or end of one task (or group, or milestone) to the beginning or end of another.
When you create a dependency, the dependent task automatically reschedules itself to respect the dependency. With further changes to the schedule and leveling, the tasks continue trying to follow the dependencies. If a dependency becomes impossible or you manually cause a task to stop obeying its dependencies, a violation occurs, which can be resolved with the Violations window.
The Omni Automation support in OmniPlan is particularly useful for automating the creation and setup of tasks and their related dependencies.
Instance Properties
The properties of a dependency.
dependent (Task) • The dependent of this dependency, which is the target Task whose schedule is effected.
dependentAlignedToEnd (Boolean) • Whether this dependency aligned to the start or the end date of its dependent task. A value of true indicates the dependency between the tasks begins at the end of the first task.
kind (DependencyKind) • The kind of dependency.
leadTimeDuration (Duration or null) • The lead time before the dependent task, as a duration object.
leadTimePercentage (Number or null) • The lead time before the dependent task, as a percentage of the duration of the prerequisite.
prerequisite (Task r/o) • The prerequisite of this dependency, which is the source Task that helps determine when the target Task is scheduled.
prerequisiteAlignedToEnd (Boolean) • Whether this dependency aligned to the start or the end date of its prerequisite task.
Instance Functions
The functions that may be applied to an instance of a dependency.
remove() • Call to delete this dependency, removing it from it’s prerequisite and dependent tasks.
DependencyKind
OmniPlan supports four types (*) of dependencies that describe the ways in which tasks relate to one another. The dependency connection between two tasks can be tethered at either the beginning or end of task.
FinishFinish* (DependencyKind r/o) • With Finish to Finish, when the first task ends, then the second one can end; the tasks may overlap.
FinishStart* (DependencyKind r/o) • With Finish to Start, the first task must end before the second task can start; the tasks must not overlap except at the instant the first one ends. This is the most common type of dependency, and the kind that you get when you connect two selected tasks by clicking the Connection button in the toolbar.
Invalid (DependencyKind r/o) • This will be the result of a property query if the current connection is an invalid dependency kind.
StartFinish* (DependencyKind r/o) • With Start to Finish, once the first task starts, the second one can finish; the tasks must overlap at least at the instant the first one starts.
StartStart* (DependencyKind r/o) • With Start to Start, once the first task has started, the second one can start; the tasks may overlap.
all (Array of DependencyKind r/o) • An array of all items of this enumeration.
Creating Dependencies
Here is a script example demonstrating the establishment of a dependency between two newly created tasks. In this example, the dependent task is set to begin after the prerequisite task has completed.
Create Dependent Pair of Tasks
var task1 = actual.rootTask.addSubtask()
task1.title = "Prerequisite"
var task2 = actual.rootTask.addSubtask()
task2.title = "Dependent"
var dependency = task1.addDependent(task2)
dependency.kind = DependencyKind.FinishStart
Here is the result of the execution of the example script in the document:
The same result can be achieved with an abbreviated version of the previous script, where tha type of dependency is assigned in the statement in which the dependency is created. (see line 5)
Create Dependent Pair of Tasks
var task1 = actual.rootTask.addSubtask()
task1.title = "Prerequisite"
var task2 = actual.rootTask.addSubtask()
task2.title = "Dependent"
task1.addDependent(task2).kind = DependencyKind.FinishStart
Also note that the same results can be achieved by creating a dependent relationship between the two created tasks using the addPrerequisite(…) function of the Task class called on the second task instance rather than the first task instance. (see line 5)
Create Dependent Pair of Tasks
var task1 = actual.rootTask.addSubtask()
task1.title = "Prerequisite"
var task2 = actual.rootTask.addSubtask()
task2.title = "Dependent"
task2.addPrerequisite(task1).kind = DependencyKind.FinishStart
Clearing All Dependencies
Here’s a script that clears all dependencies from all tasks in the actual scenario.
Clear All Dependencies
actual.rootTask.descendents().forEach(task => {
task.dependents.forEach(dependency => dependency.remove())
})
Add “Lead-Time” to Dependency
Sometimes it is practical to add a delay to a dependency so that non-project related events can occur. For example, say you order new kitchen cabinets for a renovation project. There would be two tasks: “Order the Cabinets”, and “Install the Cabinets”. To allow for the cabinet fabrication and shipping, you would add a “lead-time” duration (perhaps 12 days) to the task dependency object.
Adding “Lead-Time”
var task1 = actual.rootTask.addSubtask()
task1.title = "Order Cabinets"
var task2 = actual.rootTask.addSubtask()
task2.title = "Install Cabinets"
var dependency = task1.addDependent(task2)
dependency.kind = DependencyKind.FinishStart
dependency.leadTimeDuration = Duration.elapsedDays(12)
Group Task with Dependent Subtasks
Here are some script examples demonstrating how to create a group task whose subtasks have dependent relationships.
Task Group with Sequential Subtasks
var groupTitle = "Home Exterior Maintenance"
var jobTitles = ["rake leaves","mow lawn","clean gutters","trim hedges"]
var groupTask = actual.rootTask.addSubtask()
groupTask.title = groupTitle
groupTask.type = TaskType.group
var subTasks = new Array()
jobTitles.forEach((jobTitle,index) => {
var task = groupTask.addSubtask()
task.title = jobTitle
subTasks.push(task)
if(index > 0){
dependency = task.addPrerequisite(subTasks[index-1])
dependency.kind = DependencyKind.FinishStart
}
})
By changing the value of the dependency’s kind property (line 13) to DependencyKind.StartStart the subtasks can be set to run a concurrent (simultaneous) manner: