Organizations are able to deliver sophisticated mobile-offline solutions for their field crews by leveraging the configurable capabilities of Geocortex Workflow in their Geocortex Mobile apps. Whether you’re developing an intuitive search tool or a robust field inspection form, this Geocortex Tech Tip will help you with the debugging process in your development.
“Hi, my name is Patrick Fingler and in this Tech Tip video, I’m going to show you how you can debug workflows inside of Geocortex Mobile. Let’s see it in action!
In this Tech Tip video, we’re going to review how to debug workflows in Geocortex Mobile.
What I’ve done here is I’ve added a really simple workflow to the “I Want To” menu, which essentially will get one of the layers in the current application. I think in this scenario, I’m getting the Fire Hydrants layer. I’m then going to get the current map extent. I’m going to do a query to identify all the hydrants within that extent and then I’m going to send them to our results.
So, let’s just go ahead and run it, and here you can see it’s retrieved the extent and it’s then presented all of the hydrants that fall within that extent.
A very basic workflow.
So, let’s go ahead and first take a look at what that looks like.
This is the workflow again, I’m only using four activities to do this.
The first activity here is I’m using the Get Layer Activity to essentially get a layer and that’s really useful especially in Geocortex Mobile because if you’re doing anything offline, you can actually provide the layer as input for the query layer activity instead of a URL which would only work online. So, that’s really nice there.
Essentially what I’m doing is I’m getting the layer, this layer ID comes from the web map itself. This is the web map I’m referencing in Geocortex Mobile and I’m just retrieving the layer ID from the web map, so that’s fire hydrants and then getting the map extent and then performing a query. I’m passing in my layer my map extent, we’re returning the geometry, getting all the fields, and then I’m just passing the output of this into the Show Results activity and it’s then essentially highlighting all of the fire hydrants within my extent in my Geocortex Mobile application. Again a very simple workflow.
Let’s first make a change to it. So, maybe I want to instead use water mains as my layer. So, I’ll click save and let’s refresh my app and I’ve actually deliberately made an error. If I try to click Search Assets By Extent here, you’re going to see it says there’s an error with the query task activity.
How do we debug this, where did I go wrong?
What we’ll do is if you haven’t used Geocortex Mobile or you’re not familiar with the debugging experience, there’s this cog or settings option and then here you can see there’s this log viewer.
Before opening that up we’re going to make sure that the Log Level is set to Debug. I think by default it’s set to Info so you’ll want to set that to Debug and then re-run your workflow if it’s not yet set and then if you open up the log viewer, this is going to open up this panel which essentially documents all of the activities within the Mobile viewer and setting the debug option will output all of the workflow activities that get fired.
Now, if you click on this Filter option too, you can filter the logs and you can also search for keywords. If I search for Workflow, it’s going to filter all of my workflow activities.
So, if we first click on the error, we can see it says Error running Workflow, this is the error log and there’s an error with my query task activity, it’s saying that the URL was invalid, but you can also pass a layer as well. The error that we’re seeing is that either the URL or the layer that I’m passing to it is broken.
Let’s first click on the Query Task. So, the way this works is from top to bottom is going to be the most recent activities that get fired and you’re also going to see two logs for every activity. So, the bottom log is going to just be the inputs and then the top log will have both the inputs and the outputs.
Let’s first look at the query task input, so it hasn’t successfully ran, so there are no outputs here, but if we look at the inputs you can see this is what I’m passing into my query activity so my out fields are star, I’m returning the geometry.
If I expand this – yep – we’re successfully passing the geometry of the map extent, but here you can see my layer is null. So, let’s just go back and let’s look at my Get Layer Activity.
Here we can see my inputs, it’s water mains, that don’t match my web map layer name which is Water Lines, so I’ll need to update that and you can see the output is nothing generated.
Let’s just go into our web map and just confirm its Water Lines is the layer name. We’ll update that in our workflow, Water Lines, click save and let’s refresh the app.
One thing you can do when you’re building workflows is you can add this Display Logs button which will automatically open up the Log Viewer. So, there’s a command to do that which I’ll show you and alternatively, one thing you can also do is you can hit f12 on your keyboard to automatically open it as well. So, there are those two options available.
We’ll refresh my app and let’s rerun the workflow. I want to, Search Assets By Extent and now, you can see we’re retrieving all of the water lines within the current extent.
So, if again I can just click my Display Logs button to kind of make it a little bit faster to visualize your logs, and here you can see if I open up my filters and search for Workflow, you can see these are all my activities that just got fired.
Here, if I look at my second query task, we can see the inputs are my outfields the geometry is true we’re getting the geometry and here we can see we’re also passing in a layer and these are some of the properties of the layers.
So, there is a URL associated with it, that’s the ID and so on, and then we can actually look at the outputs we can see here we’ve got some features and there are 42 features and then you can go into each individual feature if you wanted to view what attributes you know, what geometry, and so on are available within each individual feature.
So, we can drill down, and we can see all of the associated attributes for each specific feature associated with the water ‘ines within our current extent and then lastly you can see that the select features activity which was the last process returned successfully.
I guess, the last thing I quickly wanted to show was this Display Logs button. If we go to Geocortex Mobile Designer here, I’ve just added a little button component in my bottom right rows called Display Logs and there’s this command you can use called log.viewer.display.
If you just type in log, you can see it’ll start populating and that’s a nice little tip for just quickly opening up the log viewer while you’re building workflows. You obviously wouldn’t want to have it in a production application and where that’s coming from is in our at the Developer Center, there’s a commands and operations documentation for Mobile and there’s this log dash-viewer.display command that will pop that up
Hopefully, you found that useful! That’s how to debug workflows in Geocortex mobile. Bye for now!”
Want to learn more about how Geocortex Mobile can streamline your mobile app development? Click the button below for more information, or to schedule a personal demonstration.