I'm comfortable creating Python scripts to then create geoprocessing services I can use in JS web applications. However, I'm having difficulty creating similar geoprocessing services for use in ArcGIS Enterprise (10.6.1) Portal as a custom analysis tool.
Using ArcMap 10.6.1, the script tool used as a basis for the geoprocessing services correctly populates the GPFeatureLayer data type with a list of layers on the map, and the resultant GPFeatureLayer derived output correctly adds to the map when the analysis is complete. But if I share this as a geoprocessing service, and try to run it as custom analysis in Portal...
a. The input layer seems hard coded - I can't choose from available layers on the map
b. Even if I choose the hard coded input layer, all I get in an Error (no resultant layer is added to my web map).
Does anyone have even a simple example of a script tool used to create a geoprocessing service for use as custom analysis in Portal? Attached in the python I used to create a toolbox for this test case.