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 / get assignments using assignment manager import arcgis gis = arcgis.gis.GIS("https://arcgis.com", "<username>", "<password>") item = gis.content.get("<item-id>") project = arcgis.apps.workforce.Project(item) assignment = project.assignments.add(assignment_type=type_1, location="100 Commercial St", geometry={'x': -7820308, 'y': 5412450}, status=0, priority=0) assignment_2 = project.assignments.get(object_id=2) - 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 - DateThe 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
 
 - batch_add(assignments)¶
- Adds the list of assignments to the project. - Argument - Description - assignments - Required - Listof- Assignment. The list of assignments to add.- Returns
- Listof- Assignment
 
 - batch_delete(assignments)¶
- Removes the list of assignments from the project. - Argument - Description - assignments - Required - Listof- Assignment. The list of assignments to remove.
 - batch_update(assignments)¶
- Updates the list of assignments in the project. - Argument - Description - assignments - Required - Listof- Assignment. The list of assignments to update.- Returns
- Listof- 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
 
 - 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
- Listof- 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 - stringThe file to upload.
 - batch_delete(attachments)¶
- Removes the list of attachments from the assignment. - Argument - Description - attachments - Required - Listof- 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 - Listof file path strings
 
 - get()¶
- This gets all of the Attachments belonging to the assignment. - Returns
- Listof- 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- For a version 2 (offline-enabled project), an integration is represented by an object - Integrationobject and can be updated in the same fashion as Assignment, AssignmentType, Dispatcher, Project, and Worker objects.- For a version 1 project, 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¢er=${assignment.latitude},${assignment.longitude}&scale=9000" } } - The urlTemplate can be generated by using the - integrationsmodule- 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 - Required for version 2 Workforce projects. Optional for version 1. - string. The url template that is used for app linking.- assignment_types - Optional: - stringor- listVersion 2 Projects: String which is a globalid representing an assignment type. This is stored at assignment_type.code. If you pass a list for this object, it will add multiple integrations, with identical integration_id, prompt, and url_template values, with differring assignment_types values.- Version 1 Projects: - 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
- dictVersion 1: dict representing the integration, Version 2:- Integration
 
 - batch_add(integrations)¶
- Argument - Description - integrations - Required - Listof- dict. The integrations to add- Returns
- ListThe list of integrations that were added
 
 - batch_delete(integrations)¶
- Argument - Description - integrations - Required - Listof- 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. This is field ‘appid’ for a Version 2 Workforce project.- Returns
- Version 1: - dictor- None, Version 2:- Integration
 
 - search(where='1=1')¶
- This returns all of the assignment integrations for the project 
 
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 / get assignment types using assignment type manager import arcgis gis = arcgis.gis.GIS("https://arcgis.com", "<username>", "<password>") item = gis.content.get("<item-id>") project = arcgis.apps.workforce.Project(item) assignment_type = project.assignment_types.add(name="Tree Inspection") assignment_type_2 = project.assignment_types.get(name="Fix Sign") - 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. Only works for v1 projects.- name - Optional - String. The name of the assignment type.- Returns
 
 - batch_add(assignment_types)¶
- Adds the list of assignment types to the project. - Argument - Description - assignment_types - Required - Listof- AssignmentTypes. The list of assignment types to add.- Returns
- Listof- AssignmentTypes
 
 - batch_delete(assignment_types)¶
- Removes the list of assignment types to the project. - Argument - Description - assignment_types - Required - Listof- 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 - Listof- AssignmentTypes. The list of assignment types to update.- Returns
- Listof- 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
 
 - search()¶
- Gets all of the assignment types in the project. - Returns
- Listof- 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 / get dispatchers using dispatcher manager import arcgis gis = arcgis.gis.GIS("https://arcgis.com", "<username>", "<password>") item = gis.content.get("<item-id>") project = arcgis.apps.workforce.Project(item) dispatcher = project.dispatchers.add(name="New Dispatcher",user_id="dispatcher_username") dispatcher_2 = project.dispatchers.get(user_id="dispatcher2_username") - 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
 
 - batch_add(dispatchers)¶
- Adds the list of dispatchers to the project. - Argument - Description - dispatchers - Required - Listof- Dispatcher. The list of dispatchers to add.- Returns
- Listof- Dispatcher
 
 - batch_delete(dispatchers)¶
- Removes the list of dispatchers to remove from the project. - Argument - Description - dispatchers - Required - Listof- Dispatcher. The list of dispatchers to remove.
 - batch_update(dispatchers)¶
- Adds the list of dispatchers to update in the project. - Argument - Description - dispatchers - Required - Listof- Dispatcher. The list of dispatchers to update.- Returns
- Listof- 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
 
 - 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
- Listof- 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
 
 - batch_add(tracks)¶
- Adds the list of tracks to the project. - Argument - Description - tracks - Required - Listof- Track. The list of tracks to add.- Returns
- Listof- Track
 
 - batch_delete(tracks)¶
- Removes the list of tracks to remove from the project. - Argument - Description - tracks - Required - Listof- Track. The list of tracks to remove.
 - batch_update(tracks)¶
- Updates the list of tracks in the project. - Argument - Description - tracks - Required - Listof- Track. The list of tracks to update.- Returns
- Listof- Track
 
 - property 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
 
 - property interval¶
- Gets/sets the tracking interval for the project (in seconds) 
 
WorkerManager¶
- class arcgis.apps.workforce.managers.WorkerManager(project)¶
- # Add / get workers using worker manager import arcgis gis = arcgis.gis.GIS("https://arcgis.com", "<username>", "<password>") item = gis.content.get("<item-id>") project = arcgis.apps.workforce.Project(item) worker = project.workers.add(user_id="worker_username", name="Worker One", status=0) - 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
 
 - batch_add(workers)¶
- Adds the list of workers to the project. - Argument - Description - workers - Required - Listof- Worker. The list of workers to add.- Returns
- Listof- Worker
 
 - batch_delete(workers)¶
- Adds the list of workers to remove from the project. - Argument - Description - workers - Required - Listof- Worker. The list of workers to remove.
 - batch_update(workers)¶
- Adds the list of workers to update in the project. - Argument - Description - workers - Required - Listof- Worker. The list of workers to update.- Returns
- Listof- 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