AssignmentManager
-
class
arcgis.apps.workforce.managers.
AssignmentManager
(project) This manages the assignments in the project. It can be accessed from the project as
assignments
Parameter
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
Parameter
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 geometryassignment_type
Optional
AssignmentType
. The assignment type that represents this assignment.assigned_date
Optional
Date
The date and time the assignment was assignedassignment_read
Optional
Bool
. A flag indicating that the mobile worker has seen the assignmentcompleted_date
Optional
Date
. The date the assignment was completeddeclined_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 assignmentstatus
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.
Parameter
Description
assignments
Required
List
ofAssignment
. The list of assignments to add.- Returns
List
ofAssignment
-
batch_delete
(assignments) Removes the list of assignments from the project.
Parameter
Description
assignments
Required
List
ofAssignment
. The list of assignments to remove.
-
batch_update
(assignments) Updates the list of assignments in the project.
Parameter
Description
assignments
Required
List
ofAssignment
. The list of assignments to update.- Returns
List
ofAssignment
-
get
(object_id=None, global_id=None) Gets the identified assignment by either an object id or global id.
Parameter
Description
object_id
Optional
integer
. The object id of the assignment to getglobal_id
Optional
string
. The global id of the assignment to get.- Returns
-
search
(where='1=1') Searches the assignments in the project.
Parameter
Description
where
Optional
string
. The where clause to use to query assignments. Defaults to ‘1=1’- Returns
List
ofAssignment
-
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
Parameter
Description
assignment
Required
Assignment
. The assignment to manage.-
add
(file_path) Adds the file as an attachment to the assignment.
Parameter
Description
file_path
Required
string
The file to upload.
-
batch_delete
(attachments) Removes the list of attachments from the assignment.
Parameter
Description
attachments
Required
List
ofAttachment
. The list of attachments to delete.
-
download
(out_folder=None) Downloads all of an assignments attachments.
Parameter
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
ofAttachment
-
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
Integration
object 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
integrations
moduleParameter
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
Parameter
Description
integration_id
Required
string
. The id of the integrationprompt
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:
string
orlist
Version 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
dict
Version 1: dict representing the integration, Version 2:Integration
-
batch_add
(integrations) Parameter
Description
integrations
Required
List
ofdict
. The integrations to add- Returns
List
The list of integrations that were added
-
batch_delete
(integrations) Parameter
Description
integrations
Required
List
ofdict
. The integrations to delete
-
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
Parameter
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.
Parameter
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.
Parameter
Description
assignment_types
Required
List
ofAssignmentTypes
. The list of assignment types to add.- Returns
List
ofAssignmentTypes
-
batch_delete
(assignment_types) Removes the list of assignment types to the project.
Parameter
Description
assignment_types
Required
List
ofAssignmentTypes
. The list of assignment types to remove.
-
batch_update
(assignment_types) Updates the list of assignment types to the project.
Parameter
Description
assignment_types
Required
List
ofAssignmentTypes
. The list of assignment types to update.- Returns
List
ofAssignmentType
-
get
(code=None, name=None) Gets the identified assignment type by either the name or code.
Parameter
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
List
ofAssignmentType
-
DispatcherManager
-
class
arcgis.apps.workforce.managers.
DispatcherManager
(project) This manages the dispatchers in the project. It can be accessed from the project as
dispatchers
Parameter
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.
Parameter
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 dispatchername
Optional
String
. The name of the dispatcheruser_id
Optional
String
. The user id of the dispatcher- Returns
-
batch_add
(dispatchers) Adds the list of dispatchers to the project.
Parameter
Description
dispatchers
Required
List
ofDispatcher
. The list of dispatchers to add.- Returns
List
ofDispatcher
-
batch_delete
(dispatchers) Removes the list of dispatchers to remove from the project.
Parameter
Description
dispatchers
Required
List
ofDispatcher
. The list of dispatchers to remove.
-
batch_update
(dispatchers) Adds the list of dispatchers to update in the project.
Parameter
Description
dispatchers
Required
List
ofDispatcher
. The list of dispatchers to update.- Returns
List
ofDispatcher
-
get
(object_id=None, global_id=None, user_id=None) This gets a dispatcher by their object id, global id, or user id.
Parameter
Description
object_id
Optional
integer
. The object id of the dispatcher to getglobal_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.
Parameter
Description
where
Optional
string
. The where clause to use to query dispatchers. Defaults to ‘1=1’- Returns
List
ofDispatcher
-
TrackManager
-
class
arcgis.apps.workforce.managers.
TrackManager
(project) This manages the tracks in the project. It can be accessed from the project as
tracks
Parameter
Description
project
Required
Project
. The project to manage.-
add
(feature=None, geometry=None, accuracy=None) Adds a track to the project.
Parameter
Description
feature
Optional
Feature
. The feature to use.geometry
Optional
Dict
. A dictionary containing the assignment geometryaccuracy
Optional
Float
. The accuracy to use.- Returns
-
batch_add
(tracks) Adds the list of tracks to the project.
Parameter
Description
tracks
Required
List
ofTrack
. The list of tracks to add.- Returns
List
ofTrack
-
batch_delete
(tracks) Removes the list of tracks to remove from the project.
Parameter
Description
tracks
Required
List
ofTrack
. The list of tracks to remove.
-
batch_update
(tracks) Updates the list of tracks in the project.
Parameter
Description
tracks
Required
List
ofTrack
. The list of tracks to update.- Returns
List
ofTrack
-
get
(object_id=None, global_id=None) This gets a track by their object id or global id.
Parameter
Description
object_id
Optional
integer
. The object id of the track to getglobal_id
Optional
string
. The global id of the track to get.- Returns
-
search
(where='1=1') Searches the tracks in the project.
Parameter
Description
where
Optional
string
. The where clause to use to query tracks. Defaults to ‘1=1’- Returns
List
ofTrack
-
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.
Parameter
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.
Parameter
Description
workers
Required
List
ofWorker
. The list of workers to add.- Returns
List
ofWorker
-
batch_delete
(workers) Adds the list of workers to remove from the project.
Parameter
Description
workers
Required
List
ofWorker
. The list of workers to remove.
-
batch_update
(workers) Adds the list of workers to update in the project.
Parameter
Description
workers
Required
List
ofWorker
. The list of workers to update.- Returns
List
ofWorker
-
get
(object_id=None, global_id=None, user_id=None) This gets a worker by their object id, global id, or user id.
Parameter
Description
object_id
Optional
integer
. The object id of the worker to getglobal_id
Optional
string
. The global id of the worker to get.user_id
Optional
string
. The user id of the worker to get.- Returns
-
search
(where='1=1') Searches the workers in the project.
Parameter
Description
where
Optional
string
. The where clause to use to query workers. Defaults to ‘1=1’- Returns
List
ofWorker
-