Layers Refresh Option in Geoprocessing Widgets.js in the WEB App Builder

Idea created by ctwilso4 on Nov 3, 2014
    New
    Score40
    • deepsheep
    • vscott1
    • ctwilso4
    • mping
    It would be great to give the user the option or either have the maps layers automatically refresh on the web map once a geoprocessing service has been completed. This should occur when "no" operational layers are added to the map when the processing is done. 

    In some cases, the geoprocessing service may just be updating various attributes in existing feature classes in the map service that just need to be refreshed to show the symbology and attribute back properly on the map. No outputs get generate from the geoprocessing services in my case.

    I was fortunate my Senior Developer figured this out by downloading the Javascript Code from the Web App Builder GUI. He located the Widget.js under the Geoprocessing folder and added the following code:

    Add the below code to your onExecuteComplete function to the widget.js file in geoprocessing folder
     
    var layers = this.map.getLayersVisibleAtScale(this.map.getScale());
                      array.forEach(layers,function(layer){
                                    if ( layer.visible ) {
                                                    layer.refresh();
                                    }             
                      });



    Guess what? It works!

    For my particular project, the online web app builder is not useable but the downloadable developer version is.

    Hope this finds you well!