Workflow Templates and Alarm Status Updates

A Connected Field Service workflow stays connected to the alarm that started it. Most activity blocks work on the data they were handed, but a notification workflow is rarely finished the moment the message goes out—it usually has to wait, find out whether anybody responded, and act on the answer.

This topic covers what a running workflow can see of its triggering alarm, the blocks that re-read that alarm as the diagram runs, the counters a loop tests against to know when to stop, and the rule that decides when an alarm starts a new workflow. It assumes you have already built a template that sends a notification. Learn more

Triggering Alarm

When an alarm matches a workflow's filter, the alarm and the fields the configuration subscribes to are handed to the workflow as its trigger. Throughout the diagram, you can read those fields in expressions with {{triggerVariable:<field>}}—for example, {{triggerVariable:Message}} for the alarm message or {{triggerVariable:AREA}} for its area.

The trigger also carries {{triggerVariable:NewState}}, a bit field describing the alarm's condition. Learn more

Blocks That Refresh the Alarm

Most activities work on the data they were given. The following blocks are different: each one re-reads the current state of the triggering alarm before it evaluates, so the diagram sees what has happened to the alarm since the workflow started.

Block

Usage

Alarm

Evaluates if the alarm is currently in alarm—enabled and active, and not acknowledged.

Ack

Evaluates if the alarm is currently acknowledged, whether or not it is still active.

Normal

Evaluates if the alarm has returned to normal—acknowledged and no longer active, or disabled.

Alarm Delay

Delays for a period of time or until a condition is met. It refreshes alarm information as it does, and can be interrupted early when a condition becomes true.

Workflow Variables

Alongside the alarm fields, a running workflow exposes its own counters as {{cfscoreVariable:<name>}}. They are what a loop tests against so that it stops.

Variable

Description

IsCurrentAlarm

False once the active time of the alarm no longer matches the active time the workflow started with. This tells the diagram that the alarm it was dispatched for has cycled into a new instance, and that this workflow should stop.

IterationCount

How many times execution has passed through the loop.

ListCompletionCount

How many times the worker list has been worked through. Because a dynamic worker list is re-evaluated each pass, this does not necessarily match the number of times any one worker has been contacted.

WorkerName

The name of the worker currently being contacted.

WorkerEmail

The email address of the worker currently being contacted.

One Workflow per New Alarm

A workflow is started by a new alarm, and a new alarm means a unique alarm with a new active time. A change of sub-condition on an alarm that is already active—a limit alarm moving from LoLo to Hi, for instance—is not a new alarm and does not start a second workflow.

If you need different behavior per state, you have two options:

  • Separate the states into individual alarms on the Alarm Server, so each one triggers its own workflow.

  • Loop the single workflow through condition blocks, and test the state on each pass.

Guarding a loop condition with IsCurrentAlarm can be used to gracefully terminate a looping workflow if there is a newer workflow instance that may also be acting upon the alarm. This can help prevent duplicate messaging.

Sample Templates

The Connected Field Service sample configuration installed with GENESIS contains templates that demonstrate these patterns, and they are a good place to see a working diagram before you build your own.

  • Simple Template—Sends one email to a fixed address.

  • Ack Loop Template—Looks up a list of workers and emails them one at a time until the alarm is acknowledged, the alarm returns to normal, or every worker has been contacted once.

  • Escalation Template—As above, but once two workers have been contacted without a response, it looks up the managers group and notifies them instead.

  • Alarm Area Filtering Template—Looks up only the workers associated with the alarm's area, and then loops as the Ack Loop Template does.

What's Next?