I would like to copy a polygon from one feature layer to another one in a web application in Portal for ArcGIS containing both polygon layers. I have a federated ArcGIS for Server, to which I have published a geoprocessing service with the following code in it:
inPolygon = arcpy.GetParameter(0)
copyLayer = arcpy.GetParameter(1)
with arcpy.da.InsertCursor(copyLayer, ['PIN','SHAPE@']) as icursor:
with arcpy.da.SearchCursor (inPolygon, ['PIN','SHAPE@']) as cursor:
for row in cursor:
So I have a layer going in for which I create a search cursor, with the resulting rows copied to another layer with an insert cursor. This works fine on the desktop. When I publish the geoprocessing service in ArcGIS for Server, I make the layers interactive so that the user can choose the input and output layers. Indeed, In Portal this works and I can let the user select these layers. Note that both layers in Portal for ArcGIS are the same type (polygon) and both have an attribute field named "PIN".
However the copying does not work. I have also tried using the "select" widget to select one polygon of the input layer as well then redirect that input to the geoprocessing service, but nothing works. The error I am getting in ArcGIS for Server logs is "The workspace is not connected".
Does anyone has an example of how to copy a polygon feature from one feature layer to another in Portal for ArcGIS using a geoprocessing service?