SchedulingChanges#
One set of edits to a live Project: tasks, links, resources and assignments to add, update or remove. Build it as a plain object and pass it to Project#apply or Project#preview, or put it in a Candidate. Project#suggestAssignments returns one in result.changes.
Fields#
| Field | Type | Default | Description |
|---|---|---|---|
baselineId |
string |
none | Baseline token the edits were made against. Omitted: no check. Set: it must name the project's current baseline, or the call throws ProjectError "stale-baseline". |
tasks |
bucket of TaskData / TaskUpdate |
empty | Tasks to add, update or remove by id. |
links |
bucket of LinkAdd / LinkUpdate |
empty | Links to add, update or remove by id. A LinkAdd without an id gets a generated one. |
resources |
bucket of ResourceData / ResourceUpdate |
empty | Resources to add, update or remove by id. |
assignments |
bucket of AssignmentData / AssignmentUpdate |
empty | Assignments to add, update or remove by id. |
Each bucket is an object with three optional arrays:
| Field | Type | Default | Description |
|---|---|---|---|
add |
record array | [] |
New records, in the bucket's add type. |
update |
record array | [] |
Partial records: id is required, every other field is optional. |
remove |
Id[] |
[] |
Ids of the records to remove. |
A bucket set to null reads as empty. null in place of one of its arrays is a parse error. Unknown keys on the change set or on a bucket throw an InputError; unknown fields inside the records are ignored, so objects with extra UI fields can be passed as they are.
There's no calendars bucket. Calendars change only through a full solve(data).
Take the token for baselineId from the latest solve result (ScheduleResult baselineId). Tokens are opaque: don't compare them across runs.
Operation order#
Operations run in a fixed order, not in the order the keys appear. Kinds run in the order tasks, links, resources, assignments. Within a kind:
| Kind | Order |
|---|---|
tasks |
remove, add, update |
links |
remove, update, add |
resources |
remove, add, update |
assignments |
remove, update, add |
Within an array, records run in array order. Each operation is named by its bucket and index, such as "tasks.update[0]", in the path of the ApplyReport entries.
Used by#
Project#apply:changesis committed to the accepted stateProject#preview:changesis scheduled on a copy of the baselineProject#evaluate: eachCandidatecarries one aschangesProject#suggestAssignments: returns one asresult.changes, ready forapply
Example#
Move task 1, link it to task 2 and check the edit against the current baseline.
// solved: the result of the latest project.solve(...)
const = ;
Related#
Project#apply- committing a change setTaskUpdate- thetasks.updaterecordsApplyReport- whatapplyaccepted and rejected- Editing a project - change sets, applying and rescheduling
- Previewing Changes - previewing an edit before committing it