Can anyone help me understand what file(s) and code chunks I need to look at to customize the info, warning, or error messages that get sent to the Output tab of the GP Widget in WAB? Related to this, what should I do if I wanted to output my own custom messages into an on-screen message window that opens only after GP widget is done executing? Thanks!
Solved! Go to Solution.
Sure thing, do you have an email I can send to directly?
I am interested in this solution since I am trying to do the same. Is there any way you can share the workaround solution?
Regards,
EC
Hi Ernestocd
I achieved this by creating a python script from desktop and publishing as a Geoprocessing service that can then be served up in the geoprocessing widget. Your script should contain an output that has an arcpy.AddMessage() and arcpy.SetParameterAsText() . The set parameter as text will be the thing that passes information as an output.
Here's a small snippet of what this looks like:
In the properties of the script tool, set your parameter properties to be Type: Derived & Direction: Output (this makes sure the message you put in for SetParameterAsText() is an output)
Additionally, when you are publishing your service on the Parameters tab of the Service Editor box, set the message level to Info
Hope this helps! Feel free to reach out if you get stuck
Worked like a charm! Thanks
@Ahna Miller, this is an excellent technique; I've been attempting to accomplish this for more than a week, thanks! One question: although my messages print to the Output tab, they only appear after the GP widget is finished executing. Is this your experience? Ideally, I would like my users to see messages while the process is running, especially during long-running scripts. Is there a way to output messages while the process is running? Thanks again
So glad it worked well for you!
What you describe has been my experience as well, unfortunately. If you, or anyone here has found how to do it, I'd appreciate the advice- maybe the key lies in synchronous or asynchronous publishing of the service?
Hey Robert -- just confirming before I edit one of the annoyingly detailed GP services that everything else is in order
Once the geoprocessing/widget.js is updated to pull in the appropriate message types:
and once the job is configured to report 'Info' level messages (and the script is doing so):
and the python script sets an output parameter of the output message, then the geoprocessing widget should show all messages after the geoprocessing task is complete.
Am I missing anything, to your knowledge?
Not that I know of.
Awesome, i'll give it a go and report back to the team