Select to view content in your preferred language

Geoprocessing services: Send feature(s) selected in map as parameters for tool?

66
1
2 weeks ago
ShareUser
Esri Community Manager

I'd like to build a Geoprocessing service to generate a report for a Survey123 record, to be used in an Experience Builder Geoprocessing/Analysis widget. The feature report widget is not viable at this time for reasons listed here:

I have the basis of the tool built and can successfully generate a report.

Where I'm running into problems sending the selected features to the tool (and also making sure that there is a selection).

If I were doing it in Pro, I'd do something like "aprx.activeMap, listLayers("layerIcareabout")[0], getselectionSet()". 

How can do I feed selected layers to the tool in AGOL? I always want a particular feature service used but I want it to be map-aware so I'm not trying to generate a report for every record.

Thanks!

0 Kudos
1 Reply
ShareUser
Esri Community Manager

Update: I do not have a working product yet, but here is what I found so far.

There does not seem to be any way to hard code in a specific layer. This is annoying.

It appears that the route to go is to use a Feature Set Parameter (GPFeatureRecordSet). This connects nicely to the local map. 

However, any selections are ignored. What is then passed to the tool is the layer's source URL, which is not what I'm looking for.

I have been able to pass in the selection by using the Table Widget and "Set as Analysis Input".

 

Screenshot 2026-02-24 123458.png

Screenshot 2026-02-24 123537.png

However, this a weird extra step that I don't feel my users should have to do.

I thought perhaps there may be a way to do that through an action on the table widget, but I struck out on that; it only lets you select related features or zoom to them on the map.

Again, though, I'm really looking for a way to hard-code in the layer I want to use and just use whatever it has selected.

If anyone has any tips I'd really appreciate it.

0 Kudos