How can I assign a user?

351
1
08-09-2021 09:57 AM
Jcordovafredes
Occasional Contributor II

Hello everyone, in the following image you can see how I managed to make 48 assignments, but these are unassigned

Jcordovafredes_0-1628527957419.png

 

I want the assignments to be defined to a user that I already have in a csv file (attached) in row  assigned.

 

my code is the following:

 

Jcordovafredes_1-1628528134839.png

I already tried the following code without any result:

workers=row["Assigned"]

 

or if there would be another way to assign users?

 

Thanks

0 Kudos
1 Reply
nzjs
by
New Contributor III

I haven't used the Workforce module in the API myself, but looking at the docs there are a few things I'd try. 

- Update the property name from workers to worker - see docs here
https://developers.arcgis.com/python/api-reference/arcgis.apps.workforce.html#assignment

You might need to use a Worker object rather than username string from csv, such as below

workers = project.workers.search()

 Or by creating a Worker object manually: https://developers.arcgis.com/python/api-reference/arcgis.apps.workforce.html#worker 

Good luck.

0 Kudos