I have a ArcGIS Pro 2.9.12 python toolbox tool that adds a feature layer to a map. A simplified version is below. It works fine in ArcGIS Pro, but when I publish it to my ArcGIS 10.6 Server I can't figure out how to achieve the same effect where the user runs an AGOL WAB geoprocessing widget and the result is a new layer in the map. Here are the relevant parts of the tool
def getParameterInfo(self):
return [arcpy.Parameter(displayName="States", name="states", datatype="GPFeatureLayer", parameterType="Derived", direction="Output")]
def execute(self, parameters, messages):
db_dir = r'C:\Users\dmorri28\Documents\ArcGIS\Projects\MyProject\CC-SQL2k16-ERC-SDE.sde'
feature_class = os.path.join(db_dir, "ROW_Habitat.SDE.USA_States_Generalized_Trimmed")
layer_name = "States"
lyr = arcpy.MakeFeatureLayer_management(feature_class, layer_name)[0]
arcpy.SetParameter(0, lyr)
Here are the publishing options
I've tried various combinations and nothing works. I do see various errors in the server manager log:
Do anybody know the secret to making this work?
Solved! Go to Solution.
After working with ESRI customer support we determined that this could be fixed by upgrading the ArcGIS Pro client and the ArcGIS Server to the latest releases (3.3 and 11.3)
When I change the output parameter data type from GPFeatureLayer to GPLayer, the WAB widget starts allowing me to set the symbology and allows me to "Add result as operational layer" without "View result with a map service" which is progress and I think is what I want (I'm not sure of the pros and cons of viewing with a map service - do I need it?). However when I run it this way the widget completes with a message "The result is empty." There are no errors in the service log, and from the browser network trace I see this being returned from the server
{jobId: "jd972954c64554cecaab51457add1b7df", jobStatus: "esriJobSucceeded",…}
inputs
:
{}
jobId
:
"jd972954c64554cecaab51457add1b7df"
jobStatus
:
"esriJobSucceeded"
messages
:
[,…]
0
:
{type: "esriJobMessageTypeInformative", description: "Start Time: Thursday, May 16, 2024 10:25:41 AM"}
description
:
"Start Time: Thursday, May 16, 2024 10:25:41 AM"
type
:
"esriJobMessageTypeInformative"
1
:
{type: "esriJobMessageTypeInformative", description: "Start Time: Thursday, May 16, 2024 10:25:41 AM"}
description
:
"Start Time: Thursday, May 16, 2024 10:25:41 AM"
type
:
"esriJobMessageTypeInformative"
2
:
{type: "esriJobMessageTypeInformative", description: "Running script States..."}
description
:
"Running script States..."
type
:
"esriJobMessageTypeInformative"
3
:
{type: "esriJobMessageTypeInformative", description: "Completed script States..."}
description
:
"Completed script States..."
type
:
"esriJobMessageTypeInformative"
4
:
{type: "esriJobMessageTypeInformative",…}
description
:
"Succeeded at Thursday, May 16, 2024 10:25:44 AM (Elapsed Time: 2.67 seconds)"
type
:
"esriJobMessageTypeInformative"
5
:
{type: "esriJobMessageTypeInformative",…}
description
:
"Succeeded at Thursday, May 16, 2024 10:25:44 AM (Elapsed Time: 2.68 seconds)"
type
:
"esriJobMessageTypeInformative"
results
:
{states: {paramUrl: "results/states"}}
After working with ESRI customer support we determined that this could be fixed by upgrading the ArcGIS Pro client and the ArcGIS Server to the latest releases (3.3 and 11.3)