How to Implement Custom tool Validation for Geoprocessing Widget

5815
13
09-16-2015 10:11 AM
AlexisGreen
New Contributor II

I've added a geoprocessing service to the Geoprocessing widget in Web AppBuilder.  Within the GP tool that was authored in ArcGIS Desktop, I have some custom validation logic written using Python, which works fine when running the GP tool in ArcGIS Desktop, but which is ignored when publishing the tool as a GP service and running it via Web AppBuilder's Geoprocessing widget.  The UI for my tool consists of 2 drop-down menus to collect the 2 input parameters from the user.  The parameter validation needs to happen before tool execution, and I need the validation logic to update the values in the 2nd drop-down menu based on the value that the user chooses in the 1st drop-down menu.

It seems that a possible approach to implementing this type of special validation code would entail using the Developer Edition of Web AppBuilder to customize the "Settings UI".  Anyone have experience with this type of client-side parameter validation in Web AppBuilder who would be willing to share some tips with me?  Is this something that would be relatively easy to do, or does it require advanced JavaScript development or experience with the API?  Thanks for any feedback.

13 Replies
LanceKirby2
Occasional Contributor II

Any update on this? I am trying to publish a gp service to be used in WAB that allows the user to select any layer within the first parameter and have a dropdown in the second parameter of fields associated with that layer. 

0 Kudos
JyotiRohodia
New Contributor III

Hi Lance,

I think you can achieve this workflow using a script tool in ArcGIS Pro. Configure Field type parameter and set "Dependency" on the input layer.- inside script tool properties.

Hope this helps.

0 Kudos
LanceKirby2
Occasional Contributor II

Thanks Jyoti. I've tried to get that to work several times. I was hoping someone could confirm that they have actually implemented it!

0 Kudos
tigerwoulds
Occasional Contributor III

I'm hitting the same wall with a very similar issue. Unfortuatenly I think validation code from a working Python toolbox does not carry over to the GP Widget in WAB. This guy had this same problem and 2016 and suggests building the functionality in JS rather than python. Ugh...

3 Lessons I Learned from Publishing Geoprocessing Services in ArcMap (ifeomacollins.com)

0 Kudos