arcgis-pro – Does Web AppBuilder GP Widget Handle Validation from Python Toolbox Published as GP Service?

arcgis-proarcgis-web-appbuildergeoprocessing-servicepython-toolbox

I have created a python toolbox in ArcGIS Pro that I want to share as a GP Service. The user inputs their Portal URL, username, password and the GIS Server parameter dynamically provides a dropdown with a list of GIS Servers federated to the Portal. Based on which sever is selected, the GIS Folder provides a dropdown list with available folders on that server.

enter image description here

This works great in ArcGIS Pro. But when published to ArcGIS Enterprise as a Web Tool/GP Service, my Geoprocessing Widget in WAB does not provide the dropdowns. In fact, nothing happens. Is there a way to keep my validation code working in the GP Widget?

Best Answer

Have a look at the section of the Authoring GP Service tools, Python section on tool validation.

Simply, the validation logic is fired at execution time, not before. However, in the vast majority of situations this is pretty useless. In your case, inside ArcGIS Pro, validation fires and updates parameters based on previous parameter values, all before the tool is executed. The GP Service framework doesn't offer this capability of filling out one (or more) parameter values, have tool validation executed, and respond back to the caller.

Generally, the answer is you need to take the logic from tool validation and build it into the application calling the GP Service. You said you're using WAB, that means you'd need to either build a widget from scratch or extend the GP widget and introduce the logic of getting a user/pass/URL and talking to the Portal to populate your parameters. I'd also remove the validation from the tool > service, because as I said, becomes useless in the service and actually is adding unnecessary execution overhead.

I'll note - there was talk about having web tools "send" validation code from the service back to a smart client (ArcGIS Pro), and have it execute/work for these service tools. However, I don't think this was implemented. I'll also note that this would probably never happen with a web client (like JS); there is simply too much interoperability that would have to be crafted.

Related Question