Bypass the "Identify" form
Hi,
Is there a way to bypass or automatically hide the "Identify" form when you click on a feature, and instead open up a custom Form? I am creating a form for Hydrant Inspections, and if there was a way to bypass the Identify form (which they will never use), than that would save about 32,000 needless clicks a year.
Thanks,
-
Hi Brian,
There certainly is. If you go into Mobile App Designer, select your Map component, and then scroll down to the 'Events' section, you'll see the 'Map Clicked' event like so:
This is what controls the default identify behaviour. It's actually two commands, or what we call "command-chaining" like so:
First, we perform the identify, which gets the feature/s from the map. Second, we pipe that result/s into the feature details panel (if only one feature is returned) or the search results panel (if 2 or more features are returned).
So what you could do is override the onClick event and simply replace it with whatever you'd like. You could do a similar command chain but replace the 'results.display' command with something like a 'workflow.run' command and launch your inspection form. It's meant to be quite flexible.
The full list of commands/operations and their syntax are described in our Dev Center docs:
https://developers.vertigisstudio.com/docs/mobile/api-commands-operations-events/
Hope that helps!
Phil
0 -
Thanks Phil. Is there somewhere I can go to see some sample code of how to run a worklow? I can't seem to figure out the syntax.
This is what I have so far:
[{"name": "workflow.run","arguments": {"id": "<id from ArcGIS Online>","target": "auto","portalItem": "<URL from ArcGIS Online>"}}]0 -
Hi Brian. You bet! If you simply add a Workflow to an app in Mobile App Designer, and then inspect the app.json (either via something like Item Manager or the SuDo editor in App Designer itself (Ctrl + Shift + E <-- keyboard shortcut)) you'll see that this is how the apps themselves run Workflows. For example, I simply added a Workflow into my I Want To Menu, and Designer lists the syntax like so:
The key piece is that the "id" property refers not to the ID from ArcGIS Online, but instead refers to the ID of the Workflow item in the app.json. So that's another thing to note. Your Workflow needs to be somewhere in your app for you to be able to call it. This is an essential part of how Mobile can take Workflows offline. When we launch an app, we scan the app.json for any and all Workflow references, and then download them onto your device so you have a local copy, which we can reference when you're in a map area with no internet connection.
A simple trick I like to use to get Workflows into my app.json is to go into the Services tab in App Designer, into the Launch Link Workflows section (which is also a cool tool), and add my Workflow there, like so:
Launch Link Workflows don't show up anywhere in the app, as they just designed to fire when a launch link is used, so it's an effective way of "hiding" Workflows in your app in case you don't want your users to stumble across them and use them at the wrong time.
So your flow would roughly look like this:
1. "Hide" the Workflow you want to run as a launch link workflow
2. Inspect the app.json to find that Workflow, and then copy its ID value
3. Configure your Map On Click event as you'd like - then target the ID from step 2 for your workflow.run command
Hope that helps!
Phil
1 -
Hi Phil,
Ok, so I have had zero trianing on this and I'm just trying to figure things out as I go. So to get the ID of my workflow, where do I find this SuDo editor you mention?
To get to VertiGIS Studio Mobile, I am going to a url. I guess the Mobile and Workflow designer are hosted on a server we have on site. But I see there is also a downloadable VertiGIS-Studio-Mobile-5.25.0.msi that I can download from your website. Is this SuDo editor available in that??
0 -
Hi Brian,
Sorry, I should have clarified. The SuDo (Superuser Does) editor is an advanced tool that lets you look at how your app is constructed. It's contained within Mobile App Designer (or I think what you're calling VertiGIS Studio Mobile), the Designer URL you're going to in your on-site server. If you simply load the app you're working with, then do that keyboard shortcut I described (Ctrl + Shift + E), it will open up the editor, which lets you see the configuration file which is what defines your app. It should look something like this:
You want to be careful not to change things in that window, since it can impact your app, but to simply find that Workflow you want to run, you can click into that window and do a Ctrl + F to open a little finder window, which should help you get the ID of the Workflow you want to run.
We designed the default mobile template to be a solid, well-rounded experience for our users, but the whole platform is meant to be very configurable, like what you're trying to do by overriding the identify function.
Hope that helps!
Phil
0 -
Ah, Ctrl-Shift-E.....not sure how I missed that. :-)
Thanks!!
1 -
Hmmm....ok. I think I understand what is happening, but still not working. When I identify a manhole, I get a massive error message filled with all sorts of information.
I'm pretty sure I'm getting the ID correctly, but my workflow has the name "Manhole Inspection", but in the SuDo I don't actually see that name listed anywhere. I had to find it by using the AGOL ID, and then just took whatever was in the id section for that item. So maybe I just have the totally wrong ID?? Or is there something wrong with my code??
"onClick": [{"name": "workflow.run","arguments": {"id": "c405f724-e357-4455-8fcb-80002c0f5209","async": null}}]0 -
It's not uncommon for the app.json to not contain your direct Workflow name. Our software is designed to support multiple languages, so all names and titles are stored using key:value pairs. Most often you'll see the language key, which then gets translated as appropriate when the app is run.
What sort of error are you getting? Could you please include a screenshot?
If you've got your onClick configured like you've displayed, then the question would be what is the Workflow trying to do? If you're trying to identify a specific manhole to perform an inspection, we need some way of passing that value into the Workflow. This could look something like a Workflow which:
1. performs the identify operation - we'd want to make use of the 'Get Workflow Input' activity to get the context of where you'd clicking
2. passing that identify output into your inspection form - this way it'll be performed appropriately
3. then running the inspection form to collect the data from the user for that specific manhole
This definitely starts to get trickier and will likely require a bit of trial and error to make it do exactly what you're looking for.
One important tool to help guide Workflow development is the log viewer that is found within the Mobile app itself. If you open the Settings panel (you can find this at the bottom of the I Want to Menu), you'll see a little link called 'Log Viewer' at the bottom, like so:
If you change your log level to 'Debug', when you run a Workflow, you'll be able to use the log viewer to inspect the syntax that Mobile expects. So for example if I run the 'Form' Workflow template that is provided in Mobile App Designer, and then open my log viewer, I'll see 2 copies of every activity contained in that Workflow:
The first log is run when the activity starts, and the second log is run when the activity runs to completion. If I then click into one of those logs (say the 2nd one so I can see everything), I can then inspect the inputs and outputs of that activity. In this case, I'm looking at the Reverse Geocode activity:
By clicking on the little arrows, I can expand or collapse the object to see how it's constructed.
This is definitely getting a bit far afield from your original question, but when it comes to constructing complex Workflows and passing inputs and outputs around, it's an invaluable tool to guide your efforts.
0 -
OK, thanks Phil. Yes, I've designed everything so far with the Identify window working, and then my form opens after the user clicks the "Manhole Inspection" button/action that is available. So most likely as you said, something with passing data.
I'll investigate a bit more. Thanks for your help!!
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
9 kommentarer