Geocortex Workflow 5 is a powerful tool that allows web-map developers to quickly and efficiently create complex user interfaces and geoprocessing tasks. However, just one or two design decisions can affect the quality and portability of your Workflow. In this article, I will outline some of the best practices that Geocortex’s Professional Services team applies when using Geocortex Workflow 5.
1. Parameterize Your Workflows
Activities in Geocortex Workflow 5 require inputs such as URLs, field names and spatial references that become problematic when a workflow is migrated to new environments, or if the underlying data sources changes. It is difficult to hunt through all containers, activities and form events to find references to a map service URL. This is best avoided by passing in this information at the start up of the workflow as a set of parameters.
The simplest way to do this is to include these parameters as arguments to the workflow. These can be captured using the Get Workflow Inputs activity. The only downside to this approach is that the arguments must be configured in either the Web AppBuilder Geocortex Workflow 5 widget or Viewer for HTML5 RunWorkflowById task. This isn’t so much of a problem except when there are many parameters, as they can become difficult to manage in a small interface.
In cases where there are many parameters, we recommend creating a stand-alone JSON configuration file (Code 1 below). The sample below illustrates the format of a typical JSON configuration file. Typical configuration parameters include sub workflow, report and map service URLs, and query parameters. The added value of this approach is that these parameters can be changed without having to modify the Geocortex site or Web AppBuilder configuration, which can be a challenge in some production environments.
Code 1. Sample JSON configuration file.
Configuration JSON files are read using the Send Web Request activity. This requires that the JSON file be placed in an SSL-enabled web site (ideally within your own domain to avoid CORS issues). Typically, I deploy it to the Viewer for HTML5’s IIS web site or in the case of Web AppBuilder, in the \server\apps\[app #] (where [app #] is the number of the application running the workflow) folder of the Web AppBuilder root. Once in place, the URL to the JSON configuration file can be passed to the workflow at start up as a parameter.
2. Document your Workflows
Documentation is a lifesaver, especially if you’re working in an organization where a workflow may need to be handed off or reviewed. This doesn’t require a lengthy supporting document. A properly annotated workflow that includes descriptions of activities, notes and readable variable names is often enough (Figure 1 below).
Figure 1. Annotated containers help navigate the Workflow
3. Use Containers to Organize your Actions
It’s easy to make a plate of spaghetti when working in Geocortex Workflow 5, especially if the flow of events can move backward and forward between forms. Judicious use of Geocortex Workflow 5 containers can help avoid this problem. A container should encapsulate a single action. This shouldn’t be confused with a single activity. For example, in Figure 1 above, there are containers for initializing variables, finding a property and querying a layer. Each contains multiple activities and decisions but since they are organized by their actions, they are easy to navigate.
Your workflows should be easy to read and navigate the moment they are opened in the designer. Try to avoid nesting containers too deeply. A good rule of thumb is no more than two or three levels.
4. Call Sub-workflows for Repetitive Actions
When a sequence begins to appear repeatedly throughout your workflow, it’s a good candidate for a sub workflow. This avoids coding errors and encourages code reuse. In Figure 1 above, the property search container could be encapsulated as a stand-alone workflow. This would allow the workflow to be reused in other larger workflows or be used by itself to allow users to locate their property. Other examples include validating a token before issuing a web request or formatting a dataset for addition to the map.
Geocortex Workflow 5 allows you to rapidly implement business processes to your web mapping applications. Applying the best practices outlined above will help ensure your Workflows are readable, portable and reusable.
Looking for more information on Geocortex Workflow 5? Feel free to visit the Geocortex Workflow 5-Series Community. You can ask questions, view the latest discussions or get in touch with our support team.