Workforce migrate_assignments.py

352
3
Jump to solution
12-28-2020 12:02 PM
JayHodny
Occasional Contributor III

Hello. I am trying to use the 'migrate_assignments' script to move assignment data from Classic Workforce projects to new Workforce projects in ArcGIS for Enterprise (10.8.1 with Workforce patch installed).  I have already used the 'migrate' utility in the Workforce web app dashboard to create new Workforce projects from the classic ones.  I am using ArcGIS Pro 2.7.0 which now has ArcGIS for Python 1.8.3.  I am using the 'migrate assignment only' command prompt provided in a blog dated August 31, 2020 (Migrate a Classic Workforce project (esri.com).

From the blog: python migrate_assignments.py -u <username> -p <password> -org https://<org>.maps.arcgis.com -classic-project-id <project-item-id> -new-project-id <new-project-fs-item-id>

I am running the script from the python shell in Pro.  Regardless of the command line settings, I receive a syntax error.  I place double quotes around the parameters instead of the < >.

python drive:\folder\folder\migrate_assignments.py -u "username" -p "password" -org "https://webadaptor.cityofnewarkde.us/portal" -classic-project-id 5c792f3583e44a6b910076d0d7f04628 -new-project-id 766c82cff9464341850ce625c6e99a76

I could not find a way to download the script directly from GitHub.  Rather, I had to copy the code and paste it into Notepad to create the migrate_assignments.py.

I have tried many iterations when it comes to placing the double quotes around the parameters.  My lack of experience is evident here.  The user has admin privileges.

I am at a loss as to why this script is not running, or as to what operator error is getting in the way.  Any help would be appreciated.

0 Kudos
1 Solution

Accepted Solutions
JayHodny
Occasional Contributor III

Hi Aaron,

We continued to run into an error when running the script.  The error was stating 'assignmentRead was not listed in the table' (or something to this effect).  After spending considerable time in trial and error in the command line settings, we realized the Python code specified "assignmentRead," while the field in the classic Workforce assignment feature service was named "assignmentread."  In our copy of the Python script, we edited the field name to all lower case and the script ran successfully.

Thanks again for your help,

Jay

View solution in original post

0 Kudos
3 Replies
AaronPulver
Esri Regular Contributor

@JayHodny

You can directly download it from Github using the "Code" button and choose "Download Zip".

AaronPulver_0-1609185970720.png

You need to run the script from the command-line not from the built-in Python Interpreter in ArcGIS Pro. So open "Python Command Prompt" from inside the ArcGIS folder. This will activate the correct conda environment for you.

Screen Shot 2020-12-28 at 3.09.17 PM.png

Then run the script there (after putting in all the parameters):

Screen Shot 2020-12-28 at 3.13.51 PM.png

0 Kudos
JayHodny
Occasional Contributor III

Hi Aaron,

Good grief, how did I miss the download section?...sigh.......OK, let me give this a try.  And thank you.

Regards,

Jay

0 Kudos
JayHodny
Occasional Contributor III

Hi Aaron,

We continued to run into an error when running the script.  The error was stating 'assignmentRead was not listed in the table' (or something to this effect).  After spending considerable time in trial and error in the command line settings, we realized the Python code specified "assignmentRead," while the field in the classic Workforce assignment feature service was named "assignmentread."  In our copy of the Python script, we edited the field name to all lower case and the script ran successfully.

Thanks again for your help,

Jay

View solution in original post

0 Kudos