How can I get input parameters from url and execute geoprocessing widget on load in web appbuilder app?

1039
3
03-21-2018 02:14 PM
Labels (1)
KCMcDade
New Contributor II

I've got a web appbuilder app with a geoprocessing widget that I'd like to take a parameter from the url and execute the gp widget when the app loads.

The parameter being passed via url is a parcel ID, the gp service uses the parcel id as an input and returns some features from other featureclasses that intersect the parcel.

i'm using web appbuilder 2.7

Tags (1)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

KC,

   I use this code in one of my widgets to get access to the url parameters:

define([
...
'jimu/utils',
...
function (
...
jimuUtils
...
var myObject = jimuUtils.urlToObject(window.location.href).query || {};
if (myObject.esearch) {‍‍‍‍‍‍‍‍‍‍
  //do something
}
KCMcDade
New Contributor II

Thanks Robert.

that got me parameters that i can construct a new input query with, but I don't know how to overwrite the default input value/parameter. Any ideas?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

KC,

  Because the GP widget is setup to handle many different types of input and output based on the GP service It will be hard for my to give you any general advice on how to change the GP Widgets inputs with out knowing more specifics. Normally I will right click the input in the widget and get the input id so that I can use a dojo query to get the actual control and set the controls value in code.

0 Kudos