arcgis.apps.workforce.managers module

AssignmentManager

class arcgis.apps.workforce.managers.AssignmentManager(project)

This manages the assignments in the project. It can be accessed from the project as assignments

Argument Description
project Required Project. The project to manage.
add(feature=None, geometry=None, assignment_type=None, assigned_date=None, assignment_read=None, completed_date=None, declined_comment=None, declined_date=None, description=None, dispatcher=None, due_date=None, in_progress_date=None, location=None, notes=None, paused_date=None, priority='none', status=None, work_order_id=None, worker=None)

Creates and adds a new assignment to the project

Argument Description
feature Optional Feature. A feature containing the assignments attributes. If this is provided the other parameters are all ignored.
geometry Optional Dict. A dictionary containing the assignment geometry
assignment_type Optional AssignmentType. The assignment type that represents this assignment.
assigned_date Optional Date The date and time the assignment was assigned
assignment_read Optional Bool. A flag indicating that the mobile worker has seen the assignment
completed_date Optional Date. The date the assignment was completed
declined_comment Optional String. The comment submitted by the mobile worker.
declined_date Optional Date. The date the assignment was declined.
description Optional Description. The description associated with the assignment.
dispatcher Optional Dispatcher. The dispatcher that assigned/created the assignment.
due_date Optional Date. The date the assignment is due.
in_progress_date Optional Date. The date the assignment was started.
location Optional String. The location or address of the assignment.
notes Optional String. The notes associated with the assignment.
paused_date Optional Date. The date and time the assignment was paused.
priority Optional String. The priority of the assignment
status Optional String. The status of the assignment.
work_order_id Optional String. The work order id associated with the assignment.
worker Optional Worker. The worker assigned to the assignment
Returns:Assignment
batch_add(assignments)

Adds the list of assignments to the project.

Argument Description
assignments Required List of Assignment. The list of assignments to add.
Returns:List of Assignment
batch_delete(assignments)

Removes the list of assignments from the project.

Argument Description
assignments Required List of Assignment. The list of assignments to remove.
batch_update(assignments)

Updates the list of assignments in the project.

Argument Description
assignments Required List of Assignment. The list of assignments to update.
Returns:List of Assignment
get(object_id=None, global_id=None)

Gets the identified assignment by either an object id or global id.

Argument Description
object_id Optional integer. The object id of the assignment to get
global_id Optional string. The global id of the assignment to get.
Returns:Assignment
search(where='1=1')

Searches the assignments in the project.

Argument Description
where Optional string. The where clause to use to query assignments. Defaults to ‘1=1’
Returns:List of Assignment

AssignmentAttachmentManager

class arcgis.apps.workforce.managers.AssignmentAttachmentManager(assignment)

This manages the attachments associated with an assignment. It can be accessed from the assignment as attachments

Argument Description
assignment Required Assignment. The assignment to manage.
add(file_path)

Adds the file as an attachment to the assignment.

Argument Description
file_path Required string The file to upload.
batch_delete(attachments)

Removes the list of attachments from the assignment.

Argument Description
attachments Required List of Attachment. The list of attachments to delete.
download(out_folder=None)

Downloads all of an assignments attachments.

Argument Description
out_folder Required string. The folder to download the attachments to.
Returns:A List of file path strings
get()

This gets all of the Attachments belonging to the assignment.

Returns:List of Attachment

AssignmentIntegrationManager

class arcgis.apps.workforce.managers.AssignmentIntegrationManager(project)

This manages the assignment integrations in the project It can be accessed from the project as integrations

An integration in Workforce consists of a formatted dictionary. Two examples are shown below:

navigator_integration = {
    "id": "default-navigator",
    "prompt": "Navigate to Assignment",
    "urlTemplate": "arcgis-navigator://?stop=${assignment.latitude},${assignment.longitude}&stopname=${assignment.location}&callback=arcgis-workforce://&callbackprompt=Workforce"
}

explorer_integration = {
    "id": "default-explorer",
    "prompt": "Explore at Assignment",
    "assignmentTypes": {
        "1": {
            "urlTemplate": "arcgis-explorer://?itemID=651324c8661b42c897657f8afbe846qe&center=${assignment.latitude},${assignment.longitude}&scale=9000"
        }
}

The urlTemplate can be generated by using the integrations module

Argument Description
project Required Project. The project to manage.
add(integration_id, prompt, url_template=None, assignment_types=None)

This adds an integration to the project/

Argument Description
integration_id Required string. The id of the integration
prompt Required: string. The prompt to display.
url_template Optional: string. The url template that is used for app linking.
assignment_types Optional: dict. A dictionary containing assignment type codes as keys and a dictionaries that contains a “urlTemplate” for each code as values. If provided, this will override any general url_template specified.
Returns:dict A dictionary representing the assignment integration
batch_add(integrations)
Argument Description
integrations Required List of dict. The integrations to add
Returns:List The list of integrations that were added
batch_delete(integrations)
Argument Description
integrations Required List of dict. The integrations to delete
get(integration_id)

This gets an integration dictionary by its id

Argument Description
integration_id Required string. The id of the integration
Returns:dict or None
search()

This returns all of the assignment integrations for the project

Returns:List A list of the integrations.

AssignmentTypeManager

class arcgis.apps.workforce.managers.AssignmentTypeManager(project)

This manages the assignment types in the project. It can be accessed from the project as assignment_types

Argument Description
project Required Project. The project to manage.
add(coded_value=None, name=None)

Adds an assignment type to the project.

Argument Description
coded_value Optional dict. The dictionary storing the code and name of the type.
name Optional String. The name of the assignment type.
Returns:AssignmentType
batch_add(assignment_types)

Adds the list of assignment types to the project.

Argument Description
assignment_types Required List of AssignmentTypes. The list of assignment types to add.
Returns:List of AssignmentTypes
batch_delete(assignment_types)

Removes the list of assignment types to the project.

Argument Description
assignment_types Required List of AssignmentTypes. The list of assignment types to remove.
batch_update(assignment_types)

Updates the list of assignment types to the project.

Argument Description
assignment_types Required List of AssignmentTypes. The list of assignment types to update.
Returns:List of AssignmentType
get(code=None, name=None)

Gets the identified assignment type by either the name or code.

Argument Description
code Optional integer. The code of the assignment type.
name Optional string. The name of the assignment type.
Returns:AssignmentType
search()

Gets all of the assignment types in the project.

Returns:List of AssignmentType

DispatcherManager

class arcgis.apps.workforce.managers.DispatcherManager(project)

This manages the dispatchers in the project. It can be accessed from the project as dispatchers

Argument Description
project Required Project. The project to manage.
add(feature=None, contact_number=None, name=None, user_id=None)

Creates and adds a dispatcher to the project.

Argument Description
project Required Project. The project that the dispatcher belongs to.
feature Optional Feature. The feature representing the dispatcher.
contact_number Optional String. The contact number of the dispatcher
name Optional String. The name of the dispatcher
user_id Optional String. The user id of the dispatcher
Returns:Dispatcher
batch_add(dispatchers)

Adds the list of dispatchers to the project.

Argument Description
dispatchers Required List of Dispatcher. The list of dispatchers to add.
Returns:List of Dispatcher
batch_delete(dispatchers)

Removes the list of dispatchers to remove from the project.

Argument Description
dispatchers Required List of Dispatcher. The list of dispatchers to remove.
batch_update(dispatchers)

Adds the list of dispatchers to update in the project.

Argument Description
dispatchers Required List of Dispatcher. The list of dispatchers to update.
Returns:List of Dispatcher
get(object_id=None, global_id=None, user_id=None)

This gets a dispatcher by their object id, global id, or user id.

Argument Description
object_id Optional integer. The object id of the dispatcher to get
global_id Optional string. The global id of the dispatcher to get.
user_id Optional string. The user id of the dispatcher to get.
Returns:Dispatcher
search(where='1=1')

Searches the dispatchers in the project.

Argument Description
where Optional string. The where clause to use to query dispatchers. Defaults to ‘1=1’
Returns:List of Dispatcher

TrackManager

class arcgis.apps.workforce.managers.TrackManager(project)

This manages the tracks in the project. It can be accessed from the project as tracks

Argument Description
project Required Project. The project to manage.
add(feature=None, geometry=None, accuracy=None)

Adds a track to the project.

Argument Description
feature Optional Feature. The feature to use.
geometry Optional Dict. A dictionary containing the assignment geometry
accuracy Optional Float. The accuracy to use.
Returns:Track
batch_add(tracks)

Adds the list of tracks to the project.

Argument Description
tracks Required List of Track. The list of tracks to add.
Returns:List of Track
batch_delete(tracks)

Removes the list of tracks to remove from the project.

Argument Description
tracks Required List of Track. The list of tracks to remove.
batch_update(tracks)

Updates the list of tracks in the project.

Argument Description
tracks Required List of Track. The list of tracks to update.
Returns:List of Track
enabled

Gets/sets if tracking is enabled for the project

get(object_id=None, global_id=None)

This gets a track by their object id or global id.

Argument Description
object_id Optional integer. The object id of the track to get
global_id Optional string. The global id of the track to get.
Returns:Track
interval

Gets/sets the tracking interval for the project (in seconds)

search(where='1=1')

Searches the tracks in the project.

Argument Description
where Optional string. The where clause to use to query tracks. Defaults to ‘1=1’
Returns:List of Track

WorkerManager

class arcgis.apps.workforce.managers.WorkerManager(project)

This manages the workers in the project It can be accessed from the project as workers

Argument Description
project Required Project. The project to manage.
add(feature=None, geometry=None, contact_number=None, name=None, notes=None, status='not_working', title=None, user_id=None)

Creates and adds a new worker to the project.

Argument Description
feature Optional Feature. The feature representing the worker.
geometry Optional Dict. The geometry of the worker.
contact_number Optional String. The contact number of the worker.
name Optional String. The name of the worker.
notes Optional String. The notes about the worker.
status Optional String. The status of the worker.
title Optional String. The title of the worker.
user_id Optional String. The user id of the worker
Returns:Worker
batch_add(workers)

Adds the list of dispatchers to the project.

Argument Description
workers Required List of Worker. The list of workers to add.
Returns:List of Worker
batch_delete(workers)

Adds the list of workers to remove from the project.

Argument Description
workers Required List of Worker. The list of workers to remove.
batch_update(workers)

Adds the list of dispatchers to update in the project.

Argument Description
workers Required List of Worker. The list of workers to update.
Returns:List of Worker
get(object_id=None, global_id=None, user_id=None)

This gets a worker by their object id, global id, or user id.

Argument Description
object_id Optional integer. The object id of the worker to get
global_id Optional string. The global id of the worker to get.
user_id Optional string. The user id of the worker to get.
Returns:Worker
search(where='1=1')

Searches the workers in the project.

Argument Description
where Optional string. The where clause to use to query workers. Defaults to ‘1=1’
Returns:List of Worker