Host and Run Workflows in the Geocortex Viewer for HTML5

Before you attempt to run a workflow from an HTML5 viewer, make sure the viewer is ready to run workflows:

Host and Run your First Workflow

There are several ways to host a workflow in an HTML5 viewer. The most common is the I Want To menu. The procedure below shows you how to configure the I Want To menu to host and run a workflow.

To use the I Want To menu to host and run a workflow:

Step 1: Configure the menu item

  1. Edit the viewer in Geocortex Essentials Manager.

  2. Click I Want To Menu in the side panel.

  3. Add a new menu item.

  4. In the Text box, type the menu item's text.

  5. In the Command box, type RunWorkflowByUrl.

  6. In the Command Parameter box, type or paste the workflow's URL.

    You can get the URL from Geocortex Workflow Designer or from ArcGIS:

  7. Click OK.

  8. Click Apply Changes.

  9. Click Save Site.

Step 2: Run the workflow

  1. Launch the viewer in your browser.

    If you use the Geocortex Mobile App Framework, you can also launch the viewer on your mobile device and run the workflow when there is no network connectivity.

  2. Click I Want To.

  3. Click the menu item that runs the workflow.

    The workflow runs.

Recommended Hosting Methods

The Geocortex Viewer for HTML5 offers several methods of hosting workflows:

It is possible to place an exported client workflow in a virtual directory and run the workflow by its URL. You cannot run server workflows this way.

The recommended hosting method depends on the inputs that the workflow takes. Workflow inputs are values that the host application passes to the workflow for the workflow to operate on. For more information, see Workflow Inputs.

The following recommendations prevent the situation in which the user has to select a feature or map location to run a workflow that doesn't require a feature or map location:

To run the workflow, the user selects the menu item or clicks the button or hyperlink.

Viewer Commands that Run Workflows

The menu item, toolbar button, or hyperlink that you configure uses an HTML5 Viewer command to run the workflow. The command that you use depends on whether the workflow takes inputs or not:

Configuration Summary

This section summarizes the commands and command parameters for the recommended hosting methods. If you are comfortable configuring menus and hyperlinks in HTML5 viewers, this may be all the information you need to configure an HTML5 host viewer. For additional information, see:

For information about accessing a workflow's inputs in the workflow, see Use a Workflow's Inputs in the Workflow.

Summary of recommended methods to configure an HTML5 viewer to run a workflow

Inputs

Method

Configuration

No inputs

I Want To menu

Toolbar

Command: RunWorkflowByUrl

Command Parameter: The workflow's URL

Example: https://myorganization.maps.arcgis.com/home/item.html?id=6447477dc3e16d8caa369a6fa4f0bffd

Design-time inputs only

I Want To menu

Toolbar

Command: RunWorkflowByUrlAndInputs

Command Parameter *: { "url": "WORKFLOW_URL", "input1": INPUT1, "input2": INPUT2, "input3": INPUT3, ... }

Example: { "url": "https://myorganization.maps.arcgis.com/home/item.html?id=819cb12d14a04d1ca66663d1632d8174", "images": "https://static.mydomain.com/images/" }

Run-time inputs and possibly design-time inputs

Context menu

Command: RunWorkflowByUrlAndInputs

Command Parameter *: { "url": "WORKFLOW_URL", "input1": INPUT1, "input2": INPUT2, "input3": INPUT3, ... }

Example: { "url": "https://myorganization.maps.arcgis.com/home/item.html?id=819cb12d14a04d1ca66663d1632d8174", "images": "https://static.mydomain.com/images/", graphic: {{context}} }

Hyperlink

Command: RunWorkflowByUrlAndInputs

Syntax *: <a href="command:RunWorkflowByUrlAndInputs?url=WORKFLOW_URL&input1=INPUT1&input2=INPUT2&input3=INPUT3...">LINK_TEXT</a>

Example: <a href="command:RunWorkflowByUrlAndInputs?url=https://myorganization.maps.arcgis.com/home/item.html?id=f2b865df633e4553b46f91fa3a87edb4&Location={Geometry}&walkingDistance=1.5">Show Walkable Sites</a>

*    Notation: In the table, items that are bold and capitalized will be replaced with your values, for example, INPUT1. Items that are bold and lower case, like input names, can optionally be replaced, for example, input1.

See also...

Workflow Inputs

Use the I Want To Menu to Host and Run a Workflow With Design-Time Inputs

To use the I Want To menu to host and run a workflow with design-time inputs:

Step 1: Configure the menu item

  1. Edit the viewer in Geocortex Essentials Manager.

  2. Click I Want To Menu in the side panel.

  3. Add a new menu item.

  4. In the Text box, type the menu item's text.

  5. In the Command box, type RunWorkflowByUrlAndInputs.

  6. In the Command Parameter box, enter an object with the workflow's URL and inputs, for example:

    {
        "url": "WORKFLOW_URL",
        "mystring": "THIS IS MY STRING",
        "mynumber": 123456
    }

    You can get the workflow's URL from Geocortex Workflow Designer or from ArcGIS:

  7. Click OK.

  8. Click Apply Changes.

  9. Click Save Site.

Step 2: Run the workflow

  1. Launch the viewer in your browser.

    If you use the Geocortex Mobile App Framework, you can also launch the viewer on your mobile device and run the workflow when there is no network connectivity.

  2. Click I Want To.

  3. Click the menu item that runs the workflow.

Use the Toolbar to Host and Run a Workflow with Design-Time Inputs

To use the toolbar to host and run a workflow with design-time inputs:

Step 1: Configure the tool

  1. Edit the viewer in Geocortex Essentials Manager.

  2. Click Toolbar in the side panel.

  3. Add a new button, like the Home button.

  4. Edit the button.

  5. In the Name box, type the text to use for the button.

  6. In the Command box, type RunWorkflowByUrlAndInputs.

  7. In the Command Parameter box, enter an object with the workflow's URL and inputs, for example:

    {
        "url": "WORKFLOW_URL",
        "mystring": "THIS IS MY STRING",
        "mynumber": 123456
    }

    You can get the workflow's URL from Geocortex Workflow Designer or from ArcGIS:

  8. Click OK.

  9. Click Apply Changes.

  10. Click Save Site.

Step 2: Run the workflow

  1. Launch the viewer in your browser.

    If you use the Geocortex Mobile App Framework, you can also launch the viewer on your mobile device and run the workflow when there is no network connectivity.

  2. Open the toolbar.

  3. Click the tool that runs the workflow.

Use a Hyperlink to Host and Run a Workflow with Inputs

You can configure hyperlinks to run workflows that take run-time inputs. Hyperlinks can also pass design-time inputs.

Hyperlinks are configured in feature descriptions. Depending on how you configure the viewer, feature descriptions can appear in map tips, search and identify results, and feature details.

To include a hyperlink in a layer's feature descriptions, you add an HTML anchor element (<a>) to the Feature Description or Feature Long Description setting, whichever you use for feature descriptions. These settings allow you to embed Viewer commands in hyperlinks, in this case, the RunWorkflowByUrlAndInputs command.

Hyperlink Syntax

The syntax for a hyperlink that runs a workflow with inputs is as follows:

<a href="command:RunWorkflowByUrlAndInputs?url=WORKFLOW_URL&input1=INPUT1&input2=INPUT2&input3=INPUT3...">LINK_TEXT</a>

The URL parameters specify the following:

Example configuration of a hyperlink that runs a workflow with one input, requestId, that uses a Field token

Configure the Hyperlink and Run the Workflow

To use a hyperlink to host and run a workflow that takes inputs:

Step 1: Configure the hyperlink

  1. Edit the layer in Geocortex Essentials Manager.

  2. On the Details tab, add an HTML anchor element like the following to the Feature Description or Feature Long Description setting, whichever you are using for feature descriptions:

    <a href="command:RunWorkflowByUrlAndInputs?url=WORKFLOW_URL&input1=INPUT1&input2=INPUT2&input3=INPUT3...">LINK_TEXT</a>
  3. Get the workflow's URL:

  4. URL encode the URL.

    For example, this URL:

    https://myorganization.maps.arcgis.com/home/item.html?id=0bfb2c0c6201474b80c7f88b82152613

    would be encoded as:

    https%3A%2F%2Fmyorganization.maps.arcgis.com%2Fhome%2Fitem.html%3Fid%3D0bfb2c0c6201474b80c7f88b82152613

    An easy way to URL encode a workflow's URL is to use a free, online URL encoder.

  5. Replace WORKFLOW_URL in the anchor element with the URL-encoded URL.

  6. Replace INPUT1 with the value of the first input, specified as a literal or as a replacement token.

  7. If you want, replace input1 with a descriptive name.

    You will use the name to access the workflow's inputs from within the workflow.

  8. Replace additional inputs in the anchor element as needed, or remove them. Remove the extra ampersands (&) as well.

  9. Replace LINK_TEXT with the text that you want to appear in the viewer.

  10. Click Apply Changes.

  11. Click Save Site.

Step 2: Run the workflow

  1. Launch the viewer in your browser.

    If you use the Geocortex Mobile App Framework, you can also launch the viewer on your mobile device and run the workflow when there is no network connectivity.

  2. To show the hyperlink, select a feature on the layer that has the hyperlink in its feature description.

    Feature descriptions can appear in map tips, search and identify results, and feature details.

    If you do not see the hyperlink, make sure you are showing the correct setting (Feature Description or Feature Long Description) in the context where you selected the feature. See Map Tips Settings, Results List Settings, and Feature Details Settings.

  3. Click the hyperlink to run the workflow.

Use a Context Menu Item to Host and Run a Workflow with Inputs

You can configure context menus to run workflows that take run-time inputs. Context menus can also pass design-time inputs.

Each context menu's location in the viewer is associated with a particular type of data. For example, the Feature Actions menu appears in the Feature Details panel, which is associated with a particular feature. Similarly, the Map Context menu is associated with a particular point on the map.

You can pass the data associated with a context menu to a workflow using the {{context}} token. In the Feature Actions menu, the {{{context}} token passes the feature. In the Map Context menu, the {{context}} token passes the geometry for the point on the map.

Command Parameter Syntax

Workflow inputs are defined in the menu item's Command Parameter setting. The inputs can be literals (design-time inputs) or the {{context}} token (run-time input).

Example command parameter for a context menu item

The command parameter has the following syntax:

{
    "url": "WORKFLOW_URL",
    "input1": INPUT1,
    "input2": INPUT2,
    "input3": INPUT3,
    ...
}

The command parameter specifies the following:

Configure the Context Menu and Run the Workflow

To use a context menu item to host and run a workflow that takes inputs:

Step 1: Configure the context menu

  1. Edit the viewer in Geocortex Essentials Manager.

  2. Click Context Menus in the side panel.

  3. Click the link for the context menu that you want to edit.

  4. Select the Desktop, Tablet, or Handheld tab, or click Configure Simultaneously to add the menu item to all three user interfaces.

    For more information, see Configure Multiple User Interfaces.

  5. Add a new menu item.

  6. In the Text box, type the menu item's text.

  7. In the Command box, type RunWorkflowByUrlAndInputs.

  8. In the Command Parameter box, enter a parameter like the following:

    {"url": "WORKFLOW_URL", "input1": INPUT1}

  9. Replace WORKFLOW_URL with the workflow's URL.

    You can get the URL from Geocortex Workflow Designer or from ArcGIS:

  10. Replace INPUT1 with the value of the first input, specified as a literal or as the {{context}} token.

  11. Replace input1 with a descriptive name.

    You will use the name to access the workflow's input from within the workflow.

    Camel case is recommended, for example, myDescriptiveName.

  12. Insert additional inputs as needed. Use commas to separate the inputs.

    For example: { "url": "WORKFLOW_URL", "input1": INPUT1, "input2": INPUT2, "input3": INPUT3

  13. Click OK.

  14. Click Apply Changes.

  15. Click Save Site.

Step 2: Run the workflow

  1. Launch the viewer in your browser.

    If you use the Geocortex Mobile App Framework, you can also launch the viewer on your mobile device and run the workflow when there is no network connectivity.

  2. Open the context menu.

    For instructions on opening the different types of context menu, see Types of Context Menu.

  3. Click the menu item that runs the workflow.

© 2019 Latitude Geographics Group Ltd. All Rights Reserved.

Documentation Version 5.12