Automatic Assignment

Automatic Assignment

You also have the option to automatically assign tasks to one of your currently active workers, that is, workers who are idle or in transit in the dashboard (worker state=[1,2]). Note that this is a basic assignment where the newly-created task is appended to the end of the optimal worker's container.

The autoAssign object property available at task creation has the following structure:

Name

Type

Description

mode

string

The desired automatic assignment mode. Either distance or load.

team

string

Optional. The ID of a team from which to pick the workers to consider for automatic assignment.

maxAssignedTaskCount

number

Optional. The maximum number of tasks a worker can have assigned after the automatic assignment is made.

considerDependencies

boolean

Optional. Whether to include the target task's dependency family (parent and child tasks) in the resulting assignment operation.

excludedWorkerIds

string array

Optional. One or more IDs of workers that should not be considered in assignment calculations.

In both modes, we calculate the geodesic distance using Vincenty's formula for ellipsoids between destination coordinates, with one meter precision.

The distance mode finds the active worker whose last-known location is closest to the task's destination.

The load mode walks the distance from the active worker's last-known location to their active task, if there is one, and through to each of the ordered destinations corresponding to the worker's assigned tasks, with the final computation being from their last-assigned task to the newly-created one. The worker who has to travel the shortest distance is considered to have the lightest load, and as such will be assigned the task being created.

If an automatic assignment is requested and successful, didAutoAssign will be set to true and the task's container details will indicate which worker the task was appended to. If we fail to find a suitable worker because of an error or any other unexpected condition, didAutoAssign will be false.

Note: maxAssignedTaskCount does not consider tasks that have been started - only assigned tasks are counted.