Magidoc

createAssignment
Mutation

Assign a user to a todo, a project, a stack, or in bulk to every todo in a slice. The target id on assignment selects the mode: todoId (single todo), projectId (project membership with a role), stackId (stack admin, role "stack_admin"), or sliceId together with projectId (bulk: one todo assignment per todo in the slice the user is not yet assigned to). userId is always required, and role (the project permission, see the field) is required for a project or stack; pass id as the string "new". Duplicate assignments for the same user and target are rejected.

Assigning a user to a project todo also puts them on the project if they are not on it yet, returned as projectAssignment. Someone already on the project keeps their project permission whatever role is sent; a new person gets role, or "member" when it is left out. Which project permission (role) the caller may grant depends on their own access: "only_my_work" is always allowed; "member" requires the caller to be a project member other than "only_my_work" (or a workspace admin or viewer); "admin", "admin+autoassign", and "member+invite" require project update rights (project admin, workspace admin, or stack admin). When the caller's own role on the project is "member" or "only_my_work", the assignment is created with pending: true and project admins are emailed approve/deny links (see approveAssignment and denyAssignment); otherwise the assigned user is notified directly. For todo assignments, notificationSent reports whether the assignment email was sent (suppressed when the assignee disabled assigned-to-task emails).

Access control: workspace admins always qualify; project targets also accept any user assigned to the project, todo targets accept project admins and users assigned to the todo, stack targets accept the stack's admins. Returns AssignmentResult with assignmentId (single) or assignments (bulk). Exceeding the rate limit (50 single or 5 bulk creates per ten minutes; for an organization access token, 500 single and 50 bulk) is reported through message rather than a GraphQL error.

Arguments

#

assignment

Non-null

Assignment payload.

Response

#

Returns AssignmentResult .

Example

#