I am working with GP task for the first time and I am having some trouble getting it to work. I have published a synchronous GP service and I am trying to use that in a JS web application.
In my application all I want is a base map and I am using a map click to draw a buffer, with a user defined distance and select all the census block points that fall within that distance and output a summary of total block points, population and housing units within the buffer, I am not using a feature layer to select features or a result map service to draw the selected points on the map, but I want to use GP task to output a summary table.
What I am trying to do is, add the buffer graphics on the map and use it to input GP task result, something like in his sample which is using the user defined polygon to input the GP task, and getting a summary of population for that area.
The GP task is working fine, because I added This GP task to the geoprocessing widget in the web app builder and it is doing exactly like I want it:
I am having trouble adding it to JS application, here is a JS fiddle with what I have so far but is not working:
This is what JSON from the service looks like:
I have also attached the image of the model used to publish the service and the details from the REST service directory.
Any help will be greatly appreciated!!