Capture Workflow Close Event
I'd like to know if there's a way for a Workflow called from a Web app is closed. The workflow we have adds temporary layers to the map that need to be removed when finished.
The current layout is a toolbar menu item launches the Workflow, and the Form is shown in a panel on the left side. If the user clicks on the menu item again, the workflow is closed. From a UI perspective, we want to maintain this function. However, if temporary layers had been added, they are not removed. Preferably, I could detect that the workflow has been closed in this way, and a subworkflow is run that cleans up the temporary layer. I'd also be open to suggestions on how to work around not being able to directly capture the exit from within the workflow.
-
These kind of issues we run in to very often as well; workflows that are closed without running to the end, or workflows that stay open in the background without any control over it. I believe that the Mobile Generic Event Listener (https://developers.vertigisstudio.com/blog/2023/03/01/mobile-generic-event-listener/) would be really interesting for these kind of issues, if it existed in Viewer.
1 -
Update: Use the new Event Service configuration, here's an example from Alisa Lindley.
----------
There is a panel close event (ui.deactivated) published on panel closure, but without custom development you can't hook into it. I have a VS Web Idea to implement a configurable app hook to that event, so you could execute a command (or WF) on panel closure in the same way that you can configure behavior for if much like you can configure behavior for a map click.
For your case though Ian, the solution seems relatively straightforward to me (doesn't it always seem simple before you go and develop it though?). When the workflow adds a temp layer, place a binding to it in app state; I would have an object in app state called something like "tempLayers" which would be an array of added layer IDs. Then, whenever the WF starts you check for layers and remove any that exist. That won't remove anything until the WF is re-run, but it at least meets the issue as described, you could prevent WF panel closure in the app config too (assuming VS Web or GVH).
Also, there is a new Event service in VS Web 5.25 that is supposed to allow for generic access to events, allowing e.g. a workflow to run from app close (or any fired app event). They say that configuring event listening is accessible by config-only, so it's probably not recommended for less experienced users, but it should allow what we're looking for. As to an example for how to use this, I haven't seen anything yet but am sure something like that is coming.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
2 Kommentare