Skip to main content

Run a Workflow from App Config

In this article, we can configure a workflow to run when the map is initialized.


Configuring a workflow to run when the map is initialized can be done through VertiGIS Studio Mobile Designer and this is the preferred method of configurable if Designer can be used. The goal of this article is to demonstrate the pattern of overriding behaviors with workflows.


Follow along by setting up the VertiGIS Studio Mobile SDK and editing the minimal layout and app config provided.


If you just need to make a small change to the layout and app config of an existing application, you can download the config and layout files for the application, tweak them, and then re-upload them.

First, let's create a basic map using the layout and app config.

<?xml version="1.0" encoding="utf-8" ?><layout    xmlns=""    xmlns:gxm=""    xmlns:xsi=""    xsi:schemaLocation=" ../../ViewerSpec/layout/layout-mobile.xsd">    <gxm:taskbar id="taskbar" orientation="vertical">        <map/>    </gxm:taskbar></layout>

Next, add an app item to the configuration for the map component, and configure the map to run ui.display-notification on initialization as a test.

{    "$schema": "..\\..\\ViewerFramework\\app-config\\mobile\\mobile-app-config.schema.json",    "schemaVersion": "1.0",    "items": [        {            "$type": "layout",            "id": "desktop-layout",            "url": "resource://layout-large.xml",            "tags": ["mobile", "large"]        },        {            "id": "map-config",            "$type": "map-extension",            "webMap": "0ba877a4185448cb832af9a661031e31",            "onInitialized": [                {                    "name": "ui.display-notification",                    "arguments": {                        "message": "Map initialized"                    }                }            ]        }    ]}

The next step is going to be replacing the ui.display-notification command with a* command. First, we need to create a workflow to use for the command.

  1. Open up VertiGIS Studio Workflow Designer and create and save a new workflow.
  1. Add an "Alert" activity as a test.
  2. Copy the ID of the the workflow from the URL

  1. Add the workflow as an app item to your app config.

The target property of the workflow app item determines the container in which the workflow UI, such as a form, will be displayed.

{    "$schema": "..\\..\\ViewerFramework\\app-config\\mobile\\mobile-app-config.schema.json",    "schemaVersion": "1.0",    "items": [        {            "$type": "layout",            "id": "desktop-layout",            "url": "resource://layout-large.xml",            "tags": ["mobile", "large"]        },        {            "id": "map-config",            "$type": "map-extension",            "webMap": "0ba877a4185448cb832af9a661031e31",            "onInitialized": [                {                    "name": "ui.display-notification",                    "arguments": {                        "message": "Map initialized"                    }                }            ]        },        {            "$type": "workflow",            "id": "map-initialized-workflow",            "title": "Map Initialized Workflow",            "target": "#taskbar",            "commandArgumentInput": "context",            "portalItem": "<your-workflow-id-here>"        }    ]}

Finally, you can configure the map to run this workflow on initialization.

{    "$schema": "..\\..\\ViewerFramework\\app-config\\mobile\\mobile-app-config.schema.json",    "schemaVersion": "1.0",    "items": [        {            "$type": "layout",            "id": "desktop-layout",            "url": "resource://layout-large.xml",            "tags": ["mobile", "large"]        },        {            "id": "map-config",            "$type": "map-extension",            "webMap": "0ba877a4185448cb832af9a661031e31",            "onInitialized": [                {                    "name": "",                    "arguments": {                        "id": "map-initialized-workflow"                    }                }            ]        },        {            "$type": "workflow",            "id": "map-initialized-workflow",            "title": "Map Initialized Workflow",            "target": "#taskbar",            "commandArgumentInput": "context",            "portalItem": "cd6bd434f3a44b479e06446318269e71"        }    ]}

Relevant SDK Samples#

The VertiGIS Studio Mobile SDK Samples project has a variety of workflow samples:

Next Steps#

VertiGIS Studio Workflow

Learn more about VertiGIS Studio Workflow

Change the Default Map Click Behavior with a Workflow

Learn more about overriding default behaviors