[Canonical page](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/assignment-data/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# AssignmentData

An assignment record: it books `value` units of one resource on one task. It appears as an entry of `assignments` in [`ProjectData`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/project-data.md>) and of `assignments.add` in [`SchedulingChanges`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/scheduling-changes.md>). With `offset` and `duration`, it books only a slice of the task's work. Slices change resource load, never task dates.

## Fields

| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` | [`Id`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/common.md#id>) \| `null` | no | generated | The assignment's id. Must be unique among assignments. When omitted or `null`, the engine generates `$generated_assignment_1`, `$generated_assignment_2`, and so on, skipping ids already in use. |
| `task` | [`Id`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/common.md#id>) | yes | - | The task the assignment books. `task_id` is accepted as an alias; when both are present, `task` wins. |
| `resource` | [`Id`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/common.md#id>) | yes | - | The resource booked. `resource_id` is accepted as an alias; when both are present, `resource` wins. |
| `value` | `number` | yes | - | Units of the resource booked, in the same units as the resource's `capacity`. `1` = 100 %. Must be finite and greater than 0. |
| `offset` | `number` \| `null` | no | `0` | Where the slice starts, as worked time from the task start, in the task's `duration_unit`. Must be finite and at least 0. |
| `duration` | `number` \| `null` | no | to the task end | Worked time the slice books, in the task's `duration_unit`. Must be finite and greater than 0. |

Fields not in this table are ignored, including an assignment `mode`. How unknown fields are handled across the wire is described in [Wire format](<https://docs.dhtmlx.com/planning-engine/wasm/wire-format.md#input-unknown-fields>).

How slices book load, including clipping at the task end and overlapping slices, is covered in [Resources and assignments](<https://docs.dhtmlx.com/planning-engine/wasm/resources-and-assignment/resources-and-assignments.md#assignment-slices>).

An assignment whose task is unscheduled stays in the project but is inactive; the result reports it with a `dropped-assignment` note. See [Resources and assignments](<https://docs.dhtmlx.com/planning-engine/wasm/resources-and-assignment/resources-and-assignments.md#assignments>).

## Errors

A missing or `null` `task`, `resource` or `value` fails the call with `parse` and no `path` (see [Required fields](<https://docs.dhtmlx.com/planning-engine/wasm/wire-format.md#required-fields>)). Under strict validation, the record also fails with `validation` at these paths:

| Path | When |
|---|---|
| `assignments[i].id` | The id is already used by another assignment. |
| `assignments[i].task` | No task has this id. |
| `assignments[i].resource` | No resource has this id. |
| `assignments[i].value` | `value` isn't finite or is 0 or less. |
| `assignments[i].offset` | `offset` isn't finite or is less than 0. |
| `assignments[i].duration` | `duration` isn't finite or is 0 or less. |
| `assignments[i]` | In `calendar_mode: "resource"`, the task calendar and the resource calendar share no weekly working time. |

In `assignments.add` of a change set, the same problems reject that operation instead. Repair validation clears an invalid `offset` or `duration` and adds a note; see [Accept messy input](<https://docs.dhtmlx.com/planning-engine/wasm/how-to/accept-messy-input.md>).

## Used by

- [`ProjectData`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/project-data.md>) `assignments`, the data of [`schedule`](<https://docs.dhtmlx.com/planning-engine/wasm/api/schedule.md>) and [`solve`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-solve.md>)
- [`SchedulingChanges`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/scheduling-changes.md>) `assignments.add`, the request of [`apply`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-apply.md>), [`preview`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-preview.md>) and [`evaluate`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-evaluate.md>) candidates

## Example

A whole-task assignment at 50 %, and two people splitting one task's work: the first 2 units of work, then the rest.

```json
{
  "assignments": [
    { "id": "a1", "task": "design", "resource": "anna", "value": 0.5 },
    { "id": "a2", "task": "build", "resource": "anna", "value": 1, "duration": 2 },
    { "id": "a3", "task": "build", "resource": "ben", "value": 1, "offset": 2 }
  ]
}
```

## Related

- [`ProjectData`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/project-data.md>) - where assignments are loaded
- [`AssignmentUpdate`](<https://docs.dhtmlx.com/planning-engine/wasm/api/types/scheduling-changes.md#assignmentupdate>) - edits to an existing assignment
- [`JsonProject.loadProfile`](<https://docs.dhtmlx.com/planning-engine/wasm/api/project-load-profile.md>) - the load the assignments book
- [Resources and assignments](<https://docs.dhtmlx.com/planning-engine/wasm/resources-and-assignment/resources-and-assignments.md>) - booking, slices and overallocation
- [Split assignment work](<https://docs.dhtmlx.com/planning-engine/wasm/how-to/split-assignment-work.md>) - slices with `offset` and `duration`
