Hi guys,
I'm trying to calculate and update a field in a feature layer in ArcGIS Online on a daily basis (using ArcGIS Arcade). I can do it manually by running the script on the field. But, I'd like to automate this.
I wrote the following python script (which works fine from ArcGIS pro installed on my desktop machine).
# Code to update a field in a Feature Layer using Arcade
import arcpy
# Feature service URL of layer to update
layerToUpdate = "https://<featureservice-url>/<layerId>"
fieldToUpdate = "fieldName"
arcadeExpression = "'Hello World'"
# Process: Calculate Field
arcpy.management.CalculateField(in_table = layerToUpdate, field = fieldToUpdate, expression = arcadeExpression, expression_type = "ARCADE", code_block = "")
But, I haven't been able to get this to work using ArcGIS Online Notebooks (Advanced runtime).
I keep getting the following error.
ExecuteError: ERROR 160228: The user does not have permission to execute the operation. Failed to execute (CalculateField).
Any help would is greatly appreciated 🙂