Skip to main content
Version: 3.9

Understanding Workflow Context in R-COM Gateway

R-COM Gateway is a dynamic, event-driven automation platform that allows you to build flexible workflows triggered by physical or digital events. One of the most powerful diagnostic and functional tools available in R-COM Gateway is the workflow context. This article explains what workflow context is, how it works, and how to view and use it effectively.

What Is Workflow Context?​

When a workflow in R-COM Gateway is executed, either by an API call, an MQTT message, a scheduled event, or manual triggering, a workflow context is created. This context acts as the live memory of the workflow job and contains all relevant runtime variables, including:

  • Input parameters
  • Global variables
  • Intermediate outputs from workflow actions
  • Retrieved or computed values (e.g., from databases, REST APIs)
  • Data structures passed between actions

Each workflow job has its own unique context, ensuring data isolation and traceability.

When Is It Generated?​

A workflow context is automatically created whenever a workflow job starts. This applies to workflows triggered by:

  • Event Rules (REST API, MQTT, Scheduler)
  • Manual execution from the UI
  • Subworkflow invocations

Why It Matters​

Workflow context serves multiple purposes:

PurposeDescription
DebuggingLets developers and engineers trace data across every step of the workflow.
TransparencyHelps understand what data the workflow received and how it was transformed.
Data PassingEnables action blocks to share information by reading/writing to the context.
Runtime BehaviorOffers insight into conditional logic or loops driven by variable values.
AuditabilityRetains a snapshot of input, output, and transformations for each workflow job.
info

Note: The workflow context is compressed before saving in the database to save space. You can choose to disable data compression by overriding the environment variable WORKFLOWPROCESSOR__ENABLEDATACOMPRESSION.

Real Example: Inspecting Workflow Context​

The screenshots below show a live workflow context in action:

Example workflow context

Example workflow context

In this example:

  • GLOBAL_VARS include platform-level settings like API base URLs, timeouts, and keys.
  • res : respose data send back from the workflow.
info

There could be more variables based on the actions used in the workflow. To examine the context offline, select Download job context to download it as JSON data.

These values are created and updated during execution via workflow actions like SetVar, FetchObjectDetails, HttpRequest, etc.

How to View Workflow Context​

You can inspect the workflow context for any completed or running job via two routes:

Option 1: From Workflow Jobs​

  • Go to Automation > Workflow Jobs.
  • Select View job context on the relevant job row.
  • In Execution context, use the copy control beside an individual value when you only need part of the context, or select Download job context to save the complete context as JSON.

Option 2: From the Event That Triggered It​

  • Go to Automation > Events.
  • Find the event that triggered the workflow.
  • Select its jobs indicator to open the related Workflow Jobs. The indicator also shows the number of failed jobs for that event.
  • Select View job context on the job you want to inspect.

When an event did not trigger a job, its jobs indicator reports No jobs. Opening related jobs first gives full visibility into how the workflow reacted to a particular event and what data it processed.

Use View job logs on the same Workflow Jobs row to open Execution logs. Filter the log entries by level, select Include system logs when needed, and use Download job logs to save the job logs for offline review.

Best Practices​

  • Name your variables clearly when using SetVar or HttpRequest actions to make context debugging easier.
  • Use dictionaries or lists to structure complex data for downstream steps.
  • Log key values using the Log action so you can correlate log messages with context values.
  • Avoid polluting context with unnecessary or redundant variables; it keeps jobs lighter and easier to debug.