ThingWorx Flow > Example: ThingWorx Alert Management Workflow
Example: ThingWorx Alert Management Workflow
This workflow illustrates a service use case where when a generator alert occurs, a service case is created and an SMS is sent to the service provider.
When a generator alert occurs, the workflow is triggered automatically.
The generator properties are obtained from the generator Thing instances for which the alert occurred.
A refueling service case is created in Trello for a low fuel-level alert event, and an email with the serial number and location is sent to a service provider.
An emergency service case is created in Trello for high engine-temperature alert branch, and an SMS is sent to the operator to shut down the generator to prevent damage. The text includes the generator model number, serial number, engine temperature, and map location.
The workflow consists of the following steps:
Step 1: Create a Thing and Alerts in ThingWorx Composer
1. In ThingWorx Composer, create your GeneratorThingTemplate based on the GenericThing Thing Template with the following properties and default values:
CoolantTemperature205
EngineTemperature280
FuelLevel75
LocationYour_Location
MapLinkYour_Location_Map_Link
ModelNumberMODEL_007
OilFilterContamination
OperatorEmailOperator_Email
OperatorMobileOperator_Mobile
OperatorNameOperator_Name
SerialNumberSN_001
2. Create alerts on the following properties:
Alert ChangeOilFilter on OilFilterContamination property when property value is >=50.
Alert HighCoolantTemperature on CoolantTemperature property when property value is >=215.
Alert HighEngineTemperature on EngineTemperature property when property value is >=300.
Alert LowFuelLevel on FuelLevel property when property value is <=10.
3. Create the GeneratorThing based on the GeneratorThingTemplate that you created in step 1.
Step 2: Add and configure the ThingWorx trigger
The following steps provide details of the values that you need to specify in the action form for this specific example. For detailed steps on configuring this trigger, see ThingWorx Trigger.
1. In the Source Entity list, select GeneratorThing.
2. In the Event list, select AnyAlert.
Step 3: Use the Get Thing Properties action
The following steps provide details of the values that you need to specify in the action form for this specific example. For detailed steps on configuring this action, see Get Thing Properties.
1. In the Find By list, select Selection.
2. In the Thing list, select your ThingWorx source entity, GeneratorThing.
Step 4: Use two Add Card actions
The following steps provide details of the values that you need to specify in the action form for this specific example. For detailed steps on configuring this action, see Add Card.
1. In the first Add Card action, do the following:
a. Rename the action to Refuel Generator.
b. Map the SerialNumber value of the Get Thing Properties action to the Card Name field, and append Refuel Generator to this field. The value of this field must appear as Refuel Generator <Mapped SerialNumber>.
2. In the second Add Card action, do the following:
a. Rename the action to Schedule Emergency Service.
b. Map the SerialNumber value of the Get Thing Properties action to the Card Name field, and append Schedule Emergency Service for High Temperature Alert to this field. The value of this field must appear as Schedule Emergency Service for High Temperature Alert <Mapped SerialNumber>.
Step 5: Use the Send an Email action
The following steps provide details of the values that you need to specify in the action form for this specific example. For detailed steps on configuring this action, see Send an Email.
1. Rename the action to Email to Refuel.
2. Map the OperatorEmail output of the Get Thing Properties action to the To field.
3. Map the SerialNumber output of the Get Thing Properties action to the Subject field, and append Diesel Generator Low Fuel Alert, Refuel today! to this field. The value of this field must appear as Diesel Generator <Mapped SerialNumber> Low Fuel Alert, Refuel today!.
4. Map the MapLink output of the Get Thing Properties action to the Body field, and append Location: to this field. The value of this field must appear as Location: <Mapped MapLink>.
Step 6: Use the Send an SMS action
The following steps provide details of the values that you need to specify in the action form for this specific example. For detailed steps on configuring this action, see Send an SMS.
1. Rename the action to SMS to Shut Down Generator.
2. Map the OperatorMobile output of the Get Thing Properties action to the To Number field.
3. Map the following values of the Get Thing Properties action to the Message field:
EngineTemperature
ModelNumber
SerialNumber
Location
MapLink
As you map the values, append text to the Message field for improved readability of the SMS. Your Message field must be as shown below:
Diesel Generator: High Engine Temperature Alert
SHUT DOWN IMMEDIATELY
Temperature <Mapped EngineTemperature>
Model <Mapped ModelNumber>
Serial Number <Mapped SerialNumber>
Location <Mapped MapLink> <Mapped Location>
Step 7: Set conditions between actions
The following steps provide details of the values that you need to create a condition for this specific example. For detailed steps, see Setting conditions between two actions.
1. Click the line between Get Thing Properties and Refuel Generator (Add Card) actions to define a condition.
2. Click Condition, and enter the following details:
a. Input—Map the name output of the ThingWorxTrigger Data.
b. Condition—Select (Text) Matches.
c. Expected—Enter LowFuelLevel.
3. Click the line between Get Thing properties and Schedule Emergency Service (Add Card) actions to define a condition.
4. Click Condition, and enter the following details:
a. Input—Map the name output of the ThingWorxTrigger Data.
b. Condition—Select (Text) Matches.
c. Expected—Enter HighEngineTemperature.
Step 8: Trigger the workflow
1. In ThingWorx Composer, update the value of the EngineTemperature property to 300.
2. Verify that the workflow is triggered, an emergency service case is created in Trello for the high engine temperature alert branch, and an SMS is sent to the operator.
Was this helpful?