Skip navigation
All Places > Workforce for ArcGIS > Blog
1 2 Previous Next

Workforce for ArcGIS

24 posts

The Workforce website ( and the Workforce beta website ( are scheduled for maintenance on Saturday, May 30th at between 07:00:00 AM EST and 09:00:00 AM EST.  During this time, you'll be unable to access either web application.

All other aspects of Workforce will be remain available, this includes the mobile application, ArcGIS API for Python and the ArcGIS Online services. 

If you are using Workforce with ArcGIS Enterprise, you will not be affected by this maintenance.

The ArcGIS Workforce team

Take automation to the next level by scheduling tasks for Workforce for ArcGIS. If you are operating on a Windows machine, you can use the Windows task scheduler to automatically run Python scripts foyour Workforce project at a customized date and time.  


Here are a couple of examples of when you might want to schedule a Python script for Workforce: 

  • You want a daily report of all completed assignments, so you schedule the export_assignments_to_csv script to run at the end of each day.  
  • Every two weeks, you want to reset workers within your project to a status of “not working”, so you schedule the reset_stale_workers script to run every other Sunday.  


All of the available Python scripts for Workforce are found in the  workforce-scripts GitHub repository. If you are new to automating tasks for Workforce, you may want to check out this introductory blog series firstAutomating Workforce with ArcGIS API for Python 


For this exercise, you will schedule the reset_stale_workers script using the Windows task scheduler. You can also use any script that makes sense for your Workforce project. 



  • Create the Python environment  
  • Clone the workforce-scripts repo and install dependencies 
  • Schedule the script in Windows Task Scheduler 


Create the Python environment

First, you will create the Python environment that you'll use to run the Python scripts for Workforce. To do so, you'll first add the ArcGIS Pro helper scripts to your system path. Then you'll create a new conda environment to run the scripts in. 


1.    Sign into ArcGIS Pro with a licensed account. Then, exit the program. 


      Note: ArcGIS Pro comes with ArcGIS API for Python and Conda. If you don’t have ArcGIS Pro, you will need to       download and install ArcGIS API for Python separately.

      For more information, see Install and set up ArcGIS API for Python


2.    Add the ArcGIS Pro helper scripts that come with Pro to your system path environment variables. This will allow you           to  run conda in the command prompt.  

       On your Windows device, search for and open System (control panel)

       In the System window, click Advanced system settings


      System (control panel) window


      In the System Properties window, click Environment Variables.


          System Properties window


   In the Environment Variables window, under System variables, select Path. Then, click Edit.


   Environment variables window


In the Edit environment variable window, click New, and add the file path to the ArcGIS Pro Python scripts. 


Here is the default file path: C:\Program Files\ArcGIS\Pro\bin\Python\Scripts 


   Edit environment variable window


Click OK


3. Open the ArcGIS Python Command Prompt. This should be located in: 


  Programs -> ArcGIS -> ArcGIS Pro -> Python Command Prompt 


    In the command prompt, run:


  conda create -n workforce --clone arcgispro-py3 –y 


  This will create a new conda environment in the following location:




  This is the environment that you'll use to run the Python scripts for Workforce. 


Clone the workforce-scripts repo and install dependencies 

Next, you'll clone the Workforce scripts to your machine and install the required Python libraries needed to run them. 


1. Clone or download the Workforce scripts found in the GitHub repository.

2. In the ArcGIS API for Python Command Prompt, navigate to the Workforce scripts folder:


   cd C:\Users\user\Desktop\workforce-script\scripts


3. Run:


    activate workforce


4. Install the required libraries using Python's default package installer, pip:


    pip install -r requirements.txt 


ArcGIS API for Python and the required libraries are now installed. You are now able to run Workforce scripts on your machine. 


Schedule a script in Windows Task Scheduler 

Finally, you will schedule a Python script to run using Windows Task Scheduler. You’ll schedule the reset_stale_workers script to run every other Sunday evening. 


1. In the Windows Start menu, search for "Task Scheduler" and open the program. Click Actions > Create taskIn the Create Task dialog box, name the task “Reset Workers” and select the Run whether user is logged on or not security option.   

   Create task dialogue window


2. In the Create Task dialog box, click Actions > New.


   Create task dialog box


    The New Action window appears.


    For the Program/script settingcopy and paste the file path for the Python environment you created earlier. The           file path should read as follows, where <account-name> is your system account name: 




   Edit action window


   For the Arguments setting, enter the complete file path to the script you want to run followed by the     script’s parameters. It should look like this:   


"<full path to>" -u <arcgis-username> -p <password> -org <url-to-your-organization> -project-id <project-id> -cutoff-date 1 -timezone "US/Eastern" -log-file "<full path to log.txt>" 


   Be sure to edit the following parameters: 

  • Include the full path to your script.
  • Edit the usernamepasswordorganization, and project-id to match your own credentials.  
  • Set the cutoff-date to 1. This tells your script to reset workers whose statuses haven’t changed in the past minute.  
  •  Include the full path to your log.txt file.  


  In the Add arguments setting, add the complete file path to the script you want to run followed by the list of parameters   (shown above). 


  Edit action window 


  Click OK to close the Edit Action window. 


3. Create a new trigger

In the Create Task dialog box, on the Triggers tab, click New to open the New Trigger window. This is where you set how often you want your script to run. For this exercise, the script is set to run every two weeks on Sunday at 10:00PM. 


New Trigger window


Click OK to close the New Trigger window. The trigger you just created is now listed in the Triggers tab.  


Triggers tab


You can set multiple triggers for your script, depending on the needs of your Workforce project. Click OK to close the Reset Workers Properties window.     


The reset_stale_workers script is now set to run every other Sunday. If you want to test that this script will work, you can run it manually at any time. Select the script in the Task Scheduler Library and click Run.     


Task Scheduler Library


After running the script, you can view the log file to confirm that it worked. 


Workforce for ArcGIS is a mobile app solution that uses the power of location to coordinate your field workforce. It integrates work management to reduce reliance on paper and provides everyone with access to the authoritative data they need. Workforce for ArcGIS is designed to help you reduce errors, boost productivity, and save money.



This blog is meant to be a live resource that will be updated to share the latest resources for working with Workforce for ArcGIS. FYI: access the general help documentation here.


Last edited: June 4, 2020


Video Resources


How to Blogs


Related Blogs



Over time, projects in Workforce may become cluttered with assignments that are no longer needed in the regular working view of the Workforce project. The project may also contain workers who, for various reasons, have not correctly updated their working status. 


This blog post will teach you several ways to clean out and maintain your Workforce projects using ArcGIS API for Python. You’ll learn how to delete assignments and assignment types, how to archive assignments by copying them to a new feature layer, and how to reset workers who have been inactive. You’ll also learn how to verify assignment completion based on the completion of work orders.


These scripts will make tidying up your Workforce projects a quick and efficient task.  



  • Download Workforce scripts
  • Delete assignments
  • Delete assignment types
  • Copy assignments to a feature layer 
  • Reset stale workers
  • Report incomplete assignments that have completed work orders
  • Additional resources


Download Workforce scripts

First, you need to clone or download the GitHub repository that contains the Python scripts for Workforce. Once it’s downloaded, navigate to the “scripts” folder in either the terminal or the command prompt.

cd C:\Users\user\Desktop\workforce-scripts\scripts

Install the required libraries using Python’s default package installer, pip:

pip install –r requirements.txt

Once these are installed, all of the available Python scripts for Workforce are ready to use.


Delete assignments

Caution: The following script will permanently delete assignments from your Workforce project. Be sure to create a backup of assignments before running this script. One way to create a backup of assignments is by running the copy_assignments_to_fs script, shown later in this blog.


The delete_assignments script allows you to delete assignments based on a specific field within the assignments layer. Quickly delete assignments based on completion status, assigned worker, or any queried field using the following script:


python -u username -p password -org "https://<org>" -project-id <project-id> -log-file "../log.txt" -where "1=1"


Run this in the terminal or command prompt after editing the username, password, organization, and project-id to match your own credentials.


Edit the where clause to query for the assignments you want to delete. Here are a few examples that demonstrate how you can write the query when using this script:


  • Someone left a company after completing hundreds of assignments during their tenure. The company queries their Worker ID and deletes all assignments they were assigned to.
  • Query: -where “WorkerID=1”
  • A snow plowing team has no reason to keep completed assignments. They query for completed assignments and delete them all.
  • Query: -where “status=3"
  • A landscaping company has completely changed their system of assigning work. They use the default where clause to delete all existing assignments.
  • Query: -where “1=1”


For more information on the values you can query for, see Overview of the Workforce Schema.

For more information on this script, see the delete_assignments readme.


Delete assignment types

The delete_assignment_types script allows you to delete all assignment types within a project. This is useful if you have many assignment types that you need to change or replace. Instead of making a new Workforce project or manually removing assignment types one by one – use the following script to delete all assignment types at once:


python -u username -p password -org "https://<org>" -project-id <project-id> -log-file "../log.txt"



Run this in the terminal or command prompt after editing the username, password, organization, and project-id to match your own credentials.


Note: The script will not run if any of the assignment types are in use.


For example, a Workforce project contained 25 assignment types related to maintaining community parks. Park maintenance standards were updated, so the assignment types needed to be replaced. The delete_assignment_types script was used to delete all of the existing types at once to make room for the new assignment types.


For more information on this script, see the delete_assignment_types readme.


Copy assignments to a different feature layer

The copy_assignments_to_fs script copies assignments from your assignments layer  to a new feature layer. This script is useful for archiving assignments -  allowing you to clean out your project without permanently deleting its assignment history.


You’ll first need to identify or create the target feature layer you want to copy assignments to. Name it something meaningful. For example, if you’re copying assignments from a tree inspection project, name the target layer tree assignment copies or tree assignment archive.  


This script uses a JSON configuration file (shown below) to map the assignment layer field names to those in the target feature layer. The field names on the left belong to the assignments layer, and those on the right belong to the target feature layer.


Default configuration file


When creating the target feature layer, use different field names to distinguish them from the assignments layer. If you don’t want to edit the default configuration file, name your target fields “Original_” followed by the original field name (shown above).


It’s important that you create a new OBJECTID and GLOBALID field in your target feature layer (named Original_OBJECTID and Original_GLOBALID, respectively). Since these are system generated fields, you may encounter duplicated values if you don’t create new fields. The Original_OBJECTID field should be an integer value, and the Original_GLOBALID field should be a string value.


Note: If your target feature layer has different field names than those shown above, edit the configuration file to match your target field names. Then save the file.


Once you have created your target feature layer and have edited the target field names in the configuration file, you are ready to run the script:


python -config-file "../sample_data/fieldMappings.json" -u username -p password -org "" -target-fl -where "1=1" -project-id -log-file "log.txt" --copy-attachments


Be sure to edit the following:

  • Provide the file path to the config-file  
  • Provide your username, password, and organization to connect to your content.
  • Provide the complete feature service URL of the target feature layer (-target-fl). For example:
  • "<server>/arcgis/rest/services/AssignmentsArchives/FeatureServer/0"
  • Use the where clause to query for the assignments you want to copy. The script defaults to copying all assignments (-where “1=1”).
  • Provide the project-id of your Workforce project.
  • Optionally, you can copy attachments (copy-attachments). Setting this parameter could slow down the script depending on how large your attachments are.

Once you run this script, your assignments will be copied to the new feature layer. After you check to make sure this was successful, you can delete those assignments from your active Workforce project.


For more information, see the copy_assignments_to_fs readme.


Reset stale workers

The reset_stale_workers script resets workers to the not working status if they haven’t changed their location, status, or contact information after a set date or time. If a worker forgets to update their status before taking a break or leaving for the day, they will still appear to be working on the dispatcher map. The following script keeps your project organized by resetting workers after a date or time that you set:


python -u -p -org -project-id -cutoff-date -timezone "US/Eastern"


Run this in the terminal or command prompt after editing the username, password, organization, and project-id to match your own credentials.


The cutoff-date acts as the threshold for when workers should be reset. Input either a specific date or amount of time (in minutes) to satisfy this parameter. For example: 


  • A manager runs this script every Monday morning to make sure each worker begins the week with a status of not working. They run the script to reset workers who haven’t updated their status in the past 24 hours. Their cutoff-date input would be 1440 (the number of minutes in 24 hours).


For more information, see the reset stale workers readme


Report incomplete assignments that have completed work orders

The report_incomplete_assignments_with_work_orders script reports assignments that have a completed work order, yet have an assignment status of unassigned, assigned, or declined. This script gives you the option to cancel assignments that meet this condition. This allows you to clear your project of completed assignments that have an incorrect status in Workforce.  


Features in Collector and surveys in Survey123 can be integrated as work orders for Workforce assignments. To learn how to integrate Survey123 and Collector with your Workforce project, see Integrate other apps.


In this example, there are four tree inspections that have been assigned to one mobile worker. The Workforce project is integrated with Survey123, so there is a survey (work order) associated with each assignment.


While the worker completed three work orders, they only updated one assignment to have a status of completed, as shown in the table below.


Work Order ID

Workforce Assignment Status

Survey123 Work Order














Run the following script to report the assignments that have completed work orders, but an incomplete status. The script will also cancel these assignments.


python -u username -p password -org -project-id -survey-id -field-name work_order_id --cancel-assignments


Be sure to edit the following:

  • Your username, password, and organization
  • The project-id for the Workforce project
  • The survey-id – this is the item ID for your survey layer
  • The field-name you used to integrate your Workforce project with either Collector or Survey123. The script defaults to using the work_order_id. This is the field used in the example above.
  • Add the optional --cancel-assignments parameter to cancel any assignments the script reports.

After running the script, it reports the incomplete assignments with completed work orders. In the example above, the script returns assignments 1 and 2 and then cancels them both.


For more information, see the report_incomplete_assignments readme.


Note: There is also a script available that reports any assignment that have a status of “completed” yet don't have a completed work order. For more information, see the report_complete_assignments_without_work_orders readme.


Additional resources

This blog post taught you how to use ArcGIS API for Python to clean and maintain your Workforce projects. See the following blog posts to learn about other ways to automate tasks for Workforce:

Feel free to test out all of the Workforce scripts in the Github repo. To learn more about the Workforce module within the Python API, see Managing Workforce for ArcGIS Projects

Welcome to another blog post that will teach you how to automate tasks for Workforce using ArcGIS API for Python. The last blog in this series was about using Python to set up and configure a Workforce project. We covered how to import workers, create assignments based off a feature layer, and assign work based on location. You can check it out here.


This blog will teach you three different ways to monitor assignments using ArcGIS API for Python. It can be overwhelming to keep up with all of the assignments within your project, especially when you have multiple workers. The following scripts are designed to help you monitor work efficiently.


You’ll learn how to create a dashboard for your project using ArcGIS Dashboards, how to monitor the status of assignments using Slack, and how to verify a worker’s location at the time they modified an assignment.



  • Scenario
  • Download Workforce scripts
  • Create a dashboard
  • Monitor assignments with Slack 
  • Check assignment completion location
  • Additional resources



A tree inspection company is using Workforce to assign inspections to workers, and there are 24 open assignments throughout the city of Atlanta. You, as the inspection lead, want an easy way to monitor the progress of these assignments.


Note: This scenario uses the project created in the first blog; however, you can use any Workforce project that you own to follow along with these exercises.


Download Workforce scripts


First, you need to clone or download the GitHub repository that contains the Python scripts for Workforce. Once it is downloaded, navigate to the “scripts” folder in either the terminal or the command prompt.


cd C:\Users\user\Desktop\workforce-scripts\scripts


Install the required libraries using Python’s default package installer, pip:


pip install –r requirements.txt


Once these are installed, all of the available Python scripts for Workforce are ready to use.


Create a dashboard


ArcGIS Dashboards is a web application that allows you to monitor your operations in real-time. While the Workforce web app allows dispatchers to edit and view assignments, a dashboard provides a read-only alternative for supervisors and users. A dashboard displays key statistics, allowing you to understand the progress of your project at a glance.


You can create a dashboard for your Workforce project with just one command.


Note: If you’d like to build a dashboard for your Workforce project without using the Python API, check out this blog.


Have the following information ready to use as parameters for the script:

  • Username
  • Password
  • Organization URL (<org>
  • Project ID 

For a complete list of parameters, see the readme for this script.


Run in either the terminal or command prompt. Be sure to swap the default parameters with your own.


python -u <username> -p <password> -org -project-id <project_id> --light-mode


Once you run this script, you’ll see a new dashboard has been shared with the group containing your Workforce project. Here’s what the dashboard for the Tree Inspections project looks like:


Dashboard for the Tree Inspections Workforce project.


The script creates a dashboard that shows worker information, assignment information, and a copy of the Dispatcher map. The dashboard will update to reflect changes in assignment completion and worker status in real time. This is great to have displayed in the office to quickly note the progress of your operation.


Monitor assignments with Slack 


Slack is an office communication tool that allows employees to stay connected with one another during the workday. By adding a webhook to a channel on Slack, you can receive information and updates from outside web sources, including Workforce.


The assignment monitor script connects your Workforce project with a webhook so that you will receive a message in Slack every time an assignment is completed. Anyone who joins the Slack channel that contains the webhook will receive these notifications.


Tip: This script can also be configured to send notifications to your email account. See the assignment_monitor readme for more information. 


To add a webhook to a Slack channel, you’ll first need to create a new app in Slack. Visit the Your Apps page in the Slack API and click Create New App.


Create new app button


Give your app an appropriate title. This one is called “Tree Inspections”. You’ll also need to select the Slack Workspace you want your app to belong to.


Create a Slack App window.


Once your app is created, you can create a webhook. Go to the Basic Information page for your app and click Incoming Webhooks.


Basic Information page for Building Apps for Slack.


Make sure that Activate Incoming Webhooks is toggled on. Then click Add new Webhook to Workspace.


Note: If you aren’t the manager for your workspace, you will need to request permission to add a webhook.


Web page for activating incoming webhooks.


A window appears requesting permission for the app to access your workspace. Select the channel you want your app to post to and click Allow.


Tip: Since this webhook will send a message every time an assignment is completed, you may want to create a channel specifically for it.


Window requesting permission for the app to access your workspace.


You have successfully created a new web hook. Copy the Webhook URL, shown below, and paste it somewhere you can easily access. You will need it for running the Python script.


Incoming Webhooks page where the Webhook URL is located.


If you go to the Slack channel you connected the webhook to, there will be a message saying a new app was integrated.


Assignment monitor channel in Slack.

Now that you have created a Slack webhook and connected it to your workspace, you are ready to run the Python script.


First, in the Assignment Monitor folder, edit the config file. Edit the file to include your project ID, slack webhook URL, organization, and log-in credentials.


Config file opened in Notepad.

Once you’re done editing the file, save it. You are now ready to run the Python script. Open the terminal or command prompt and make sure your file path points to the scripts folder:


cd C:\Users\user\Desktop\workforce-scripts\scripts


Then run the assignment monitor script:




The script will check for newly completed assignments, and a message will be sent to your assignment monitor channel on Slack when one is found. To test this, log in as one of your workers on the Workforce mobile app and complete an assignment.


A message will appear in Slack that looks like this:


Assignment completion message in Slack.


This message shows who completed what assignment and where it is located. It also shows that the worker left a note saying the assignment needs attention right away.


The script will continue checking for completed assignments every 5 seconds. To stop the script, press Ctrl+c while in the terminal or command prompt.


Tip: This script can be modified to run once as opposed to looping infinitely. It can be called every so often (i.e. once per minute) using a task scheduler such as Windows Task Scheduler or Cron.


For more information, see the assignment_monitor readme.


Check completion location 


The check_edit_location script uses data from Tracker for ArcGIS to see if a worker edited a feature without visiting its location. Assignments in Workforce, features in Collector, and surveys in Survey123 can all be checked using this script.


If you want to follow along with this exercise, find a Workforce project that has workers who have enabled location tracking.


Note: Location Tracking must be enabled for your organization to use this script. You must either be an administrator or a track viewer who can view the tracks of each worker whose work you'd like to verify.


For example, Sharon, a tree inspector, completed three assignments this morning (shown below).


Assignments that Sharon completed shown on a map.


The check_edit_location  script is used to verify that Sharon visited the location of each completed assignment.


First, clone or download the Github repository that contains the Python scripts for Tracker.


Next, open the terminal or command prompt and navigate to the scripts folder:


cd C:\Users\user\Desktop\tracker-scripts\scripts


Create the virtual environment with the correct dependencies:


conda env create --file environment.yml


Activate the environment:


conda activate tracker-scripts


Here is the check_edit_location script:


python -u username -p password -org -workers <worker1>, <worker2> -field-name completedDate -time-tolerance 10 -distance-tolerance 100 -layer-url <layer-url> -tracks-layer-url <tracks-layer-url>


Before you run it, you will want to make sure you edit the parameters as follows:


  • Provide your username, password, and AGOL organization to connect to your content.
  • List the username for each worker whose assignment and location you want to check.
  • Set the field name to the date field within the feature layer you want to verify. To check for assignment completion, use completedDate as input for this parameter.
  • Set a time tolerance that provides a range around the time when the assignment was completed. The script defaults to 10 minutes.
  • Set a distance tolerance that provides a buffer around the location where the assignment was completed. The script defaults to 100 meters.
  • Set the minimum accuracy required when querying worker locations. The script defaults to 50 meters.
  • Provide the complete feature service URL for the assignments layer. For example:
  • Enter the complete tracks layer URL if there is a specific track view you want to utilize. The script defaults to the tracks layer in your location tracking service. For example:


Once the parameters are set, run the script.


For this example, the script was run with the default parameters to see if Sharon was within 100 meters of the tree inspection assignments at the time they were completed. The script returned the following message:


The user sharon_user who last edited the feature with OBJECTID 22 was potentially not within the distance tolerance when updating the field completedDate


The script only returns assignments that are invalid. This means that Sharon did visit the location of two of the assignments she completed. However, there is one tree inspection that she may not have visited.


Next, Sharon’s tracks were added to the assignments layer to see if the script’s output made sense.


Sharon’s tracks and completed assignments displayed on a map.


Sharon’s tracks, shown in pink above, show that she visited assignments 21 and 20, but did not visit assignment 22. The script successfully reported that, though assignment 22 was completed, Sharon potentially did not visit the site of the tree inspection.


For more information about this script, see the check_edit_location readme.


Additional resources

This blog post taught you how to use ArcGIS API for Python to monitor your Workforce projects. See the following blog posts to learn about other ways to automate tasks for Workforce:

Feel free to test out all of the Workforce scripts in the Github repoTo learn more about the Workforce module within the Python API, see Managing Workforce for ArcGIS Projects.

Welcome to the first in a series of blog posts that will teach you how to automate key workflows for Workforce for ArcGIS.


The Workforce module within ArcGIS API for Python makes managing Workforce projects a simple and efficient task. We are constantly creating new scripts that simplify app-based workflows into just a few lines of code.

Whether you are setting up your first Workforce project, cleaning out a project with hundreds of old assignments, or trying to find new ways to improve your organization’s efficiency – the Python API will be a powerful addition to your geospatial arsenal.


This first blog is a step-by-step tutorial that will teach you how to configure a Workforce project and create assignments.



  • Getting started
  • Scenario
  • Download Workforce scripts
  • Import workers from a CSV file
  • Add assignment types
  • Create assignments based on an existing feature layer
  • Assign work based on location
  • Additional resources 


Getting started


If you would like to complete each task alongside this exercise, first do the following: 



Note: If you don't have an ArcGIS account, you can sign up for a free trial




In this scenario, the city of Atlanta has identified 24 trees that are at risk of falling. These trees are in heavily developed areas, so it’s crucial that they be professionally inspected. The city has hired a tree risk assessment company to perform these inspections.  


You will use ArcGIS API for Python to configure a Workforce project for the company. You will import the company’s workers, create assignments based on a feature layer containing the trees, and assign inspections to workers based on the zone that each worker oversees.


Download Workforce scripts


First, you need to clone or download the GitHub repository that contains the Python scripts for Workforce. Once it is downloaded, navigate to the “scripts” folder in either the terminal or the command prompt. I am using a Windows operating system for this example. 


cd C:\Users\user\Desktop\workforce-scripts\scripts


Install the required libraries using Python's default package installer, pip: 


pip install -r requirements.txt


Also install the shapely library. This will allow us to spatially assign work later on. 


conda install shapely


Once these are installed, all of the available Python scripts for Workforce are ready to use.


Import workers from a CSV


The import_workers Python script allows you to import workers directly from a CSV file. This script is especially useful for importing a large number of workers into a project. Rather than input your workers one by one in the Workforce app, you can run this single line of code instead.


We will use the import_workers script to import a CSV file of tree inspectors into this scenario's Workforce project. This is the CSV file that you downloaded earlier:


CSV file of tree inspectors


There are 5 tree inspectors that will be imported into the project. Their name, working status, title, contact number, and user ID will all be passed through the script.


Open this file and edit the name and userID columns with the information of at least four workers within your organization. Save your changes.


Note: This script has many options allowing the user to specify the names of each column within the CSV. Check out the import_workers readme for more information.


In the terminal or command prompt, run the import workers script:


python -u <username> -p <password> -org https://<org> -name-field name -status-field status -user-id-field userId -log-file log.txt -csv-file ../sample_data/tree_inspectors.csv -project-id <project id> -title-field title -contact-number-field contactNumber


Make sure you update the following fields with your own information:

  • Username and password
  • Organization
  • CSV file
  • Project ID (from the blank project you created) 

Once this script has been run, check that your tree inspectors have been successfully added to your project (shown below). 

List of added tree inspectors in the Workforce web interface

Add assignment types 


Note: We will be using Jupyter notebooks to complete the remaining tasks within this workflow. Notebooks are useful for visualizing data and running code step by step. Either open a blank Jupyter Notebook or follow along with the notebook you downloaded earlier.


First, import the ArcGIS API for Python library. 

Code for importing the ArcGIS API for Python

Next, connect to your GIS and fetch the project using its project ID. 

Code for connecting to your GIS and fetching the project

Once this set-up is complete, you can start performing tasks specific to your project. You’ll first want to add assignment types to the project that are relevant to tree inspections.

Code for adding assignment types to tree inspections

After you run this code, you can check that the assignment types have been successfully added to the project (shown below).

Added assignment types in Workforce web interface


Create assignments based on an existing feature layer


The city of Atlanta has provided a feature layer containing the trees that are at risk of falling. Using the Python API, you can create an inspection assignment for each feature within this layer.


First, import the datetime library. Datetime allows us to pass the current time into the assigned date field.

Code for importing the datetime library

Then you can fetch the layer containing the trees, query it, and display it on a map.


Workforce stores assignments in the WGS84 Web Mercator projected coordinate system, so let’s ensure that the returned geometries are using this spatial reference.


Here is the item ID for the trees feature layer: 88495d3b613a41f4a70b9d61ef979b34


Code for querying the trees layer and displaying it on a map

The Atlanta Trees layer is displayed. 


Now you will create 24 “Inspect tree” assignments: one for each tree. You will loop through the trees feature layer to batch add assignments using the “Inspect tree” type we created in the previous section.  

Code for creating an assignment for each tree feature within the layer

To ensure that a new assignment was created for each tree, display the assignments layer on a map.

Code for displaying assignments layer on a map.

Your project now has 24 tree inspection assignments.


Assign work based on location


You have your tree inspectors and your assignments. Now it’s time to assign work. You will assign the inspections to four workers. Each inspector oversees a specific work zone in Atlanta, so they will only inspect trees that fall within their respective zone. You will use the work zone feature layer to assign each of the 24 tree inspections to a set of four zones.


We’ll import some modules from within the arcgis library to make typing these classes easier.


Code for importing the Geometry and WebMap modules.

Next, let’s get the Inspection Zones feature layer and display it on a map.


Here is the item ID for the Inspection Zones feature layer: ac044c7a2c94401eaeb1b215200feb57


Code for displaying the zones layer on a map

Add your assignments layer to the map so you can visualize how the assignments are distributed within the zones.  

Code for adding assignments layer to map of work zones

Next, you’ll create a spatially enabled data frame from the zones layer and grab all of the unassigned assignments.

Code for creating a spatially enabled data frame from the zones layer and grabbing all of the unassigned assignments.

Assign tree inspections to workers within each of their respective zones.

  • Trees in Zone 1 should be assigned to Josh
  • Trees in Zone 2 should be assigned to Jane
  • Trees in Zone 3 should be assigned to Nirav
  • Trees in Zone 4 should be assigned to Sharon

The following code will assign each worker to the trees that fall within the work zone they are responsible for.

Code for assigning each worker to the trees that fall within the work zone they are responsible for.

Run this code and then create a map with the updated assignments layer to make sure everything was assigned properly. If you click on any of the features, the status should read “Assigned”.

Code for creating a map with the updated assignments layer.

Now, if you open your Workforce project, you can view all of your updated assignments. If you sort by assignee, you’ll see that inspectors were only assigned to work for their specific zone. You’ll see that only inspections in Zone 2 were assigned to Jane.

Assigned tree inspections in the Workforce web interface.

You have successfully set up a Workforce project and assigned work using ArcGIS API for Python!


Additional resources

This blog post taught you how to use ArcGIS API for Python to configure your Workforce projects and assign work. See the following blog posts to learn about other ways to automate tasks for Workforce:

Feel free to test out all of the Workforce scripts in the Github repoTo learn more about the Workforce module within the Python API, see Managing Workforce for ArcGIS Projects.

Workforce for ArcGIS is evolving! We're adding offline support, refreshing the mobile apps, and enhancing the project schema. 


If you are currently using Workforce or have been waiting for new features like offline support to jump in, we'd like you to join our beta program now and help us in shaping the next releases. Click the link below to join our beta program.


Join the Workforce Beta Program

Today we released a minor, bug fix update to the Workforce web app inside of ArcGIS Online. We also took this opportunity to announce our upcoming beta for offline support. Workforce is evolving and there are a lot of exciting changes about to happen. 


Read this blog article for more details and to sign up for the beta:

Workforce for ArcGIS is evolving! 

The Workforce team has been working on some new Jupyter Notebooks that demonstrate different ways that Workforce can be automated. We're pleased to announce that the following notebooks are now available in our Workforce-Scripts Github repository:


Let us know what you think and what other examples you'd like to see in the future!

FYI, here's a great video from the Esri 2018 User Conference of the Workforce for ArcGIS: An Introduction technical session presented by Jeff Shaner and Craig Gillgrass. A nice starting point to learn about Workforce for ArcGIS.


Workforce for ArcGIS: An Introduction - YouTube 




Last week, Esri released an update to the ArcGIS API for Python (v1.4.1). Among the many updates, this release included a new API for managing projects within Workforce for ArcGIS!


We’ve had sample scripts hosted on GitHub for several years which show how to use Python to accomplish many tasks such as programmatically loading assignments from external data sources, importing and managing workers, removing completed assignments, and more. However, several of those scripts require extensive knowledge of the Workforce project schema and rules. In an effort to simplify the automation of Workforce tasks, the ArcGIS API for Python now includes a specific module for managing Workforce projects. 


This is awesome new functionality that will greatly improve and simplify your Workforce automation workflows. We plan to update the workforce-scripts repo in the coming weeks to use this new module. In the meantime, please check out this this Jupyter notebook which highlights how to use the new Workforce module.


Additional documentation about the workforce module can be found here.

Workforce is designed for an office of dispatchers and a team of mobile workers in the field. The dispatchers create and assign the work, while the mobile workers complete it. Yet you might have mobile workers who notice work that needs to be done while they are in the field, and you want those mobile workers to be able to create assignments about what they see. Creating and assigning work from the mobile app is something on our roadmap, but it isn’t possible yet. However, you can bring Collector for ArcGIS into your solution and enable mobile workers to create assignments in the field today.


To get started, identify a Workforce project that requires mobile workers to have the ability to create assignments from the field. The Workforce project, as part of its creation, made some maps. However, those maps aren’t available in Collector. This is expected: Workforce maps are excluded from Collector. It would make it too easy for a mobile worker to accidentally edit assignments outside Workforce.


To opt-in to this workflow, we’ll create a view of the assignments for the mobile workers, make a map for use in Collector, give mobile workers access, and then create assignments using Collector. Let’s see how to set this up:


1. Create a view of the assignments layer

We’ve decided we want to allow access to our assignments in Collector, but we don’t want the user to have access to all the data. To limit the fields and types of data the mobile worker sees, create a hosted feature layer view from the assignments layer (view the item page for the assignments layer and click Create View Layer). Make sure to give it a unique, descriptive name to help you remember the target audience of this view. (For details, see Create hosted feature layer views - ArcGIS Online or ArcGIS Enterprise)

NOTE: If you don’t want to limit the data the worker has access to, you don’t need to create a view of the layer. Skip this step and when creating the map add the assignments layer directly into the new map. In the map, configure the pop-up for the assignments layer the same way it is configured for the layer view here.

In your view, Set View Definition (use More Options  in the Visualization tab) to limit the data available to mobile workers:

  • Define Features to only include features with a status of “Unassigned”

  • Define Fields to only include the following fields: OBJECTID, Description, Status, Priority, Assignment Type, WorkOrder ID, Due Date, GlobalID, Location, CreationDate, Creator, EditDate, and Editor. Some of these are the fields the mobile worker needs to fill out when creating assignments, and when setting up the pop-up for the map you’ll leave these editable in Collector. The others are set for you by the ArcGIS platform and you’ll hide these when setting up the pop-up.
    Note: Your mobile workers might not need all the fields. You can choose to exclude Description, Priority, WorkOrder ID, and Due Date.


Still in the Visualization tab, Configure Pop-up  (which defines the editing experience in Collector):

  • Update the Pop-up Title to show information meaningful to workers creating assignments as this map is only for their use. For example, just use the assignment type: mobile workers might not always need to include a description so the default title wouldn’t have useful information.

  • Include only the following fields, and display them in this order (so that required fields are first): Assignment Type, Location, Description, Priority, Due Date, and WorkOrder ID. Uncheck both Display and Edit in Configure Attributes for each of the other fields to exclude them.

Update the pop-up by clicking OK at the bottom of the panel, and save your changes by clicking Save Layer.


In the Settings tab for the view, enable editing and configure editing permissions in the Feature Layer (hosted, view) Settings section:

  • In the Editing section, Enable editing.
  • Enable sync if your mobile workers need to create assignments while offline.
  • Under What kind of editing is allowed? accept the default of Add, update, and delete features.
  • Under What features can editors see? accept the default of Editors can see all features, as that could reduce the creation of duplicate assignments.
  • Under What features can editors edit? set Editors can only edit their own features.

Save your changes to the settings.


2. Create a map for Collector

On the Overview tab of your assignments layer view’s item page add the layer to a new map (use the drop-down menu for Open in Map Viewer and select Add to new map). Update your map as follows:

  • Rename the layer view to “assignments” in the Content pane.
  • Remove all the feature types and their templates other than the Unassigned feature type. The mobile workers won’t need to use them, and by removing them mobile workers won’t have to set a status and will always create unassigned assignments. To remove them, click Edit and click Manage at the bottom of the pane. Next to each feature type (other than Unassigned) click the arrow to open the menu and select Remove. Make sure to remove the feature type, and not just the templates under it, and to save your changes.
  • Include any other data in the map that the mobile workers might need to see to help them create assignments.
  • Make sure you aren’t using a vector basemap as those aren’t supported in Collector.
  • If your mobile workers need to be able to take the map offline and work without a data connection, you’ll need to make sure your map follows the guidelines for making offline maps for Collector.


3. Share the map with mobile workers

You need to share your new map and your layer view with the mobile workers who need to use them.


If you want all mobile workers in your Workforce project to be able to create assignments in Collector, share them with the group created with your Workforce project. Dispatchers in the project would also have access to the map in Collector: this may or may not be useful depending on your project.


If instead you want to provide only a subset of mobile workers with access to create assignments in Collector, create a new group (see how using either the ArcGIS Online or the ArcGIS Enterprise web site). Only add into the group mobile workers that you want using Collector to create assignments. After joining the group through the ArcGIS Online or ArcGIS Enterprise website (or after an admin adds them without their need for approval), these mobile workers can access any content shared with the group. To give them access to the content they need to create assignments, share with the group the map you created for Collector, the layer view, and any other services used by the map.


4. Create assignments in Collector

The mobile worker can open the new map in Collector and create assignments. While they won’t be able to use all the validation and user integration included in the Workforce web app, they can create assignments. Some things to keep in mind:

  • The mobile worker will need to provide an Assignment Type and Location.
  • With the view and pop-up customization, they can’t set a dispatcher ID. That’s ok, as the mobile worker might not be a dispatcher. It will be set by Workforce when the assignment is assigned through the web app.
  • Need to include an attachment? Use the camera and attach as an image.
  • Be careful if deleting assignments: it is permanent and not the same as closing them.
  • You can use a feature and Collect here to create an assignment at that feature; however, the assignment’s location field won’t be prepopulated with the feature’s pop-up title as it is in the Workforce web app.


Now you’ve got your mobile workers contributing their field findings into Workforce: work they notice in the field is recorded and ready for assignment. The back office knows what needs to be done, and work is completed according to your staff’s workflow.

We are adding new features to the Workforce for ArcGIS website and wanted to let you know that we will be releasing an update in the next couple of weeks updated today (Feb 20th, 2018).!


If you are using ArcGIS Online, this will be a seamless update to the website and your existing projects will continue to work as expected.  If you are using ArcGIS Enterprise, this will be the official release supporting ArcGIS Enterprise 10.6 and when you sign in to the MyEsri website, you will find a new setup for Windows and Linux called "Workforce for ArcGIS 18.0.1" under Apps in the Downloads section. Later this week we will update MyEsri with the ArcGIS Enterprise 10.6 setup.


New in this update...

1. Instead of adding mobile workers one-by-one, you can Add Workers from a File. A template CSV file is provided for you to populate with new workers and you can pre-populate it with existing workers if you like. 




2. Explorer for ArcGIS is available within the App Integration screen on the Advanced tab so your field workers can open Explorer at the location of a work assignment and redline on top of it. You can add Explorer integration either at the Project level or at the assignment type level.


3. In our last update, we added the ability for you to pass the ID and Location Description fields from the Assignment to the feature you create in Collector or Survey123. With this update, you can now pass the GlobalID field as well. Passing the GlobalID to a string or GUID field, you can establish a relationship between the feature collected/inspected and the assignment itself. 


4. If you have enabled the use of Esri Vector basemaps in the Map settings of your Organization, we will use the Navigation basemap when creating a new project.


In addition to these 4 updates, there are a number of stability enhancements. These updates will be coming soon are now live!

Workforce for ArcGIS is rolling out a new update, both to the Workforce web app that is used to create projects and dispatch work, as well as the mobile client apps on the iOS and Android platforms.


We updated the web app, today, Tuesday October 31st, at 9:00AM PST, with a few highly requested new features:


1. Project Owners can now deepen the integration between Workforce and Collector/Survey123 by passing the Workforce ID field and Workforce Location field to attributes they map on either their web map or Survey form. This provides a loose coupling between work assignments and the work accomplished.



2. Dispatchers have additional information about work assignments that improve their decision making process. For each assignment, the name of the dispatcher is displayed and the Date/Time of when assignments were created and when an assignment changed state is displayed. 


3. Location is important when creating and assigning work and we don't want the panel to get in your way. Now you can hide/show the panel when you want to.



In addition to these top 3 enhancements we have fixed several bugs in the Workforce web app.


November 31st Update - The ArcGIS Enterprise 10.5.1 setup that includes the web app enhancements is now available on in the Apps section.


Updates to the mobile apps for iOS and Android within their respective stores in December

Wall-mounted maps have "You are here" bubbles, and our phones use a dot on the map to show current location. But those are clearly not determined the same way: a wall-mounted map always has the same location, while your phone moves about with you. And how your location is determined varies between devices and even app to app on a single device. To best understand the location information presented for mobile workers in Workforce (both our own as a mobile worker, those of other mobile workers, and those of our mobile workers when a dispatcher) we need to understand how location is determined in Workforce.


First, let's understand what the dispatcher is seeing. The location presented for each mobile worker is simply the location the mobile worker's device is passing to Workforce. Once we understand how the mobile device is handling the mobile worker's location, we'll also know how the location the dispatcher is seeing is determined. The only catch is that the location isn't updated for dispatchers continuously; instead, the mobile worker's device updates the mobile worker's current location every minute. This is the location displayed in the web app.


When a mobile worker sees the location of another mobile worker in the same project, their view of that other mobile worker's location aligns with that the dispatcher sees. While they are receiving the same information from the project, it might not exactly match the dispatcher's view. In addition to the offset introduced by mobile workers updating their location with the Workforce project every minute, the mobile worker reading the location is also only checking for updated locations every minute, so the position seen can be up to 2 minutes old.


Now let's look at the mobile worker and their device, as that is the key to all the locations. Workforce uses the location provided by the device's location services. What exactly that means depends on the device and its setup, but what we need to know is that location services determine position information from various sources, such as GPS, cellular, Wi-Fi, and Bluetooth networks. Here is a bit more detail into location services:

  • The location reported on the mobile device depends on the information available to the device. If your device doesn't have GPS, it uses a combination of cellular and wireless signals to determine your location. If your device also doesn't have GPS or cellular service, wireless signals are used. GPS generally provides the most accurate locations, after that Wi-Fi, then cellular.
  • A more accurate location means that its margin of error is less. Your position might be identical, but if you know you have 10 meter accuracy, you know you are likely within 10 meters of the location shown. If you have 30 meter accuracy, you know you are likely within 30 meters of the position shown. In Workforce, the blue circle around your position indicates the accuracy. In the image below, Workforce believes you are between the tree and the other mobile worker (green pin). However, you might be closer to the green dot, or you might be with the other mobile worker. But it is pretty sure you are inside the bigger blue circle.
    Workforce location accuracy
  • On Android, you can choose a mode for your location (High accuracyBattery savingDevice only). This changes what is used to calculate location. High accuracy (the default) uses GPS, Wi-Fi, cellular, and other available sensors through Google's Location service to get the highest-accuracy location. Battery saving doesn't use GPS, using only Wi-Fi and cellular through Google's Location service, saving battery. Device only uses only GPS, turning off Google's Location service. Changing this value affects the location you see in the app.


One last thing to understand about location services on iOS: they never provide an accuracy less than 5 meters. Even if you are using an external GPS with sub-meter accuracy, Workforce uses location services and while the position used could be more accurate, the accuracy reported will still be 5 meters, at best. You might notice this if you look at the historical tracks of where mobile workers have been.


A mobile worker will see their position updated continuously. However, as mentioned earlier, they don't update the Workforce project with the same frequency. The project is updated every minute. Additionally, if the mobile worker sets their status to On Break or Not Working, their location is not updated to the project at all until they return to Working. And if the mobile worker didn't set their status to On Break or Not Working before shutting down Workforce, the location the project has for them might be outdated and show them still working.


Got it, you might think. But then you open Collector, and see that your location has better accuracy than you are seeing in Workforce! What is going on here? Well, it actually isn't too complicated: Collector doesn't always use the device's location services, bypassing it for the information coming straight from the location sensor (such as an external GPS). Location services are limited in the accuracy that they'll report, even if the device is getting a better accuracy from the location sensor. Because accuracy is critical in data collection, Collector uses the most accurate information available. Workforce, on the other hand, doesn't have the same requirements, so uses the most easily accessed information.


Now you should understand how Workforce determines the location of mobile workers, what factors contribute to its accuracy, why it might vary between members of the same project, and why it might vary when using other apps. Now when you see worker location and it doesn't seem they are in the right place, yet the workers insist they are, you'll be able to figure out what it is you are actually seeing and how, if necessary to your project, to improve that information.