Run Workflows in the Geocortex Viewer for HTML5

If you are using an on-premises installation of Geocortex Workflow, you must adapt each viewer that hosts Geocortex workflows to point to your installation. See Adapt a Viewer to Work with On-Premises Workflow.

To configure a Geocortex HTML5 viewer to run a workflow, you add a menu item, toolbar button, or hyperlink that runs the workflow using an HTML5 Viewer command. The command that you use depends on whether the workflow takes inputs or not:

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

Do not confuse workflow inputs with user inputs. User inputs are gathered from the user by the running workflow using forms or prompts. Workflow inputs are provided to the workflow by the application that runs the workflow.

For example, a workflow that prompts the user to enter an address and then locates the address on the map has user inputs but not workflow inputs. Compare this to a workflow that operates on a feature that the user selected in the viewer. In this case, the workflow gets the selected feature from the viewer as a workflow input.

To run workflows, Geocortex Workflow must be enabled in the viewer. To check whether Workflow is enabled, edit the viewer in Geocortex Essentials Manager and click Workflow 5 in the side panel. Workflow is enabled by default in viewers created in Geocortex Viewer for HTML5 version 2.9 and newer.

Summary - Configure an HTML5 Viewer to Run a Workflow

This section summarizes how to configure a viewer to run a workflow using different methods, with or without inputs. It assumes that you are familiar with configuring menus and hyperlinks in HTML5 viewers.

For additional information, see:

Summary of methods to configure a Geocortex Viewer for HTML5 viewer to run a workflow

Inputs

Methods

Configuration

No

I Want To menu

Context menu

Toolbar

Command: RunWorkflowByUrl

Command Parameter: The workflow's URL

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

Hyperlink

Command: RunWorkflowByUrl

Syntax*: <a href="command:RunWorkflowByUrl?url=WORKFLOW_URL">LINK_TEXT</a>

Example: <a href="command:RunWorkflowByUrl?url=https://myorganization.maps.arcgis.com/home/item.html?id=90068078026b41c98b7fe959516e0195">Show Road Closures</a>

Yes

I Want To menu

Context menu

Toolbar

Command: RunWorkflowByUrlAndInputs

Command Parameter Syntax*:

One Input: { "url": "WORKFLOW_URL", "input": INPUT }

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

Command Parameter Examples:

One Input: { "url": "https://myorganization.maps.arcgis.com/home/item.html?id=15bde3fa4ee487cab3c97fa0f50125f8", "province": "Utrecht" }

Multiple Inputs: { "url": "https://myorganization.maps.arcgis.com/home/item.html?id=819cb12d14a04d1ca66663d1632d8174", "stagingArea": {$Geometry}, "mapServiceId": 12, "layerId": 32, "fieldName": "Municipal" }

Hyperlink

Command: RunWorkflowByUrlAndInputs

Syntax*:

One Input: <a href="command:RunWorkflowByUrlAndInputs?url=WORKFLOW_URL&input=INPUT">LINK_TEXT</a>

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

Examples:

One Input: <a href="command:RunWorkflowByUrlAndInputs?url=https://myorganization.maps.arcgis.com/home/item.html?id=f281039cc853416c963509fb57cbfe6f&parcel={ParcelId}">Show Parcel History</a>

Multiple Inputs: <a href="command:RunWorkflowByUrlAndInputs?url=https://myorganization.maps.arcgis.com/home/item.html?id=f2b865df633e4553b46f91fa3a87edb4&currentLocation={$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 can optionally be replaced, for example, input1.

Run a Workflow without Inputs

To run a workflow that does not take inputs, you use the RunWorkflowByUrl command in a menu item, toolbar button, or hyperlink. This command takes the workflow's URL as its parameter. When the user selects the menu item, button, or hyperlink, the viewer runs the workflow located at the URL.

Use the I Want To Menu to Run a Workflow without Inputs

To use an I Want To menu item to run a workflow without 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 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.

Run a Workflow with Inputs

To run a workflow that takes inputs, you use the RunWorkflowByUrlAndInputs command in a menu item, toolbar button, or hyperlink. This command takes a URL and one or more inputs as its parameter. When the user selects the menu item, button, or hyperlink, the viewer runs the workflow located at the URL and passes the inputs to the workflow.

To get the inputs that are passed into the workflow, you add a Get Workflow Inputs activity to the workflow. This puts the inputs into the activity's inputs property. For example, if you configure two inputs called input1 and input2 in the viewer, after the Get Workflow Inputs activity, you can access the inputs using terms similar to these:

$getWorkflowInputs1.inputs.input1

and

$getWorkflowInputs1.inputs.input2

To verify that the inputs are passed into the workflow correctly, view the verbose log and expand the log entry for the Get Workflow Inputs activity's output.

Follow the instructions to configure a viewer to run a workflow with inputs:

To configure an I Want to menu item to run a workflow with inputs, add an item to the menu and configure the Command and Command Parameter as described in Use a Context Menu Item to Run a Workflow with Inputs.

To configure a toolbar item to run a workflow with inputs, add a toolbar button (for example, the Home button) and modify it. Configure the button's Command and Command Parameter as described in Use a Context Menu Item to Run a Workflow with Inputs.

Use a Hyperlink to Run a Workflow with Inputs

You can configure feature descriptions to include hyperlinks that run workflows. 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 are using for feature descriptions. These settings allow you to embed Viewer commands in hyperlinks. In this case, you will use the RunWorkflowByUrlAndInputs command. The workflow's URL and inputs are specified as URL parameters to the command.

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

Input Types

Hyperlinks can pass in the following types of inputs:

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

Step 1: Get the inputs

  1. When you build the workflow in Workflow Designer, add a Get Workflow Inputs activity to the workflow and connect it to the flowchart.

    Typically you would place the activity near the beginning of the workflow, possibly where you initialize the workflow.

    The Get Workflow Inputs activity does not require any configuration.

Step 2: 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 3: 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 Run a Workflow with Inputs

You can configure items in Geocortex Viewer for HTML5 context menus to run workflows. For example, you could configure an item in the Feature Actions menu that runs a workflow and passes it a Feature. Or you could configure an item in the Results Table Actions menu that runs a workflow and passes it a FeatureSet.

To configure a context menu item to run a workflow that takes inputs, you use the RunWorkflowByUrlAndInputs command and specify the workflow's URL and inputs as the command parameter.

Syntax

The syntax for the parameter of the RunWorkflowByUrlAndInputs command is as follows:

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

The command parameter specifies the following:

Example configuration of a context menu item that runs a workflow with one input

Input Types

Context menus can pass the following types of inputs:

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

Step 1: Get the inputs

  1. When you build the workflow in Workflow Designer, add a Get Workflow Inputs activity to the workflow and connect it to the flowchart.

    Typically you would place the activity near the beginning of the workflow, possibly where you initialize the workflow.

    The Get Workflow Inputs activity does not require any configuration.

Step 2: 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. Use camel case, for example, myDescriptiveName.

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

  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 3: 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.10