trailhead

Activate Your Orchestration and Send Events to Test It

Learning Objectives

After completing this unit, you’ll be able to:
  • Use Workbench to send event data to your orchestration.
  • Use the traffic view to monitor the status of a device.

Activate an Orchestration

Hold onto your hat. We’re about to send this refrigerator on its first IoT flight.

You saved your orchestration, but now you need to Activate it.

  1. In your orchestration, click Activate.

    Flying Fridge Maintenance orchestration with Activate button circled

  2. In the Activating orchestration to production dialog box, click Activate. You get a green confirmation banner that your orchestration was activated.

In your orchestration, select the Traffic view to see a graphical representation of your states. Traffic view showing Default and High Temperature states

Send Events to Test an Orchestration

Before deploying your orchestration on real data, it’s a good idea to test it with some mock data to make sure it’s doing what you intended. We use Workbench to send events into the orchestration. When we send the events, the relative size of the circles changes depending on how many devices are in the state. We know things are working correctly when:

  • The instances (one for each device) show up in the traffic view.
  • The sizes of the circles change based on which state the device is in.
  • A case is automatically created when the temperature is too high.

Let’s start by sending some events to see the orchestration in action. By sending events through Workbench, we simulate events sent from a refrigerator monitoring system.

  1. In a new browser window, enter https://workbench.developerforce.com.
  2. Agree to the terms and log in with your Salesforce credentials you use for the Trailhead Playground or Developer Edition you’ve used to do all the setup so far.
  3. Click the Utilities dropdown, and select REST Explorer.
  4. In the REST Explorer page, for HTTP method, select POST. (1)
  5. Append “/sobjects/Flying_Fridge_Event__e” to the POST URL in Workbench, so it displays this: /services/data/<version>/sobjects/Flying_Fridge_Event__e. (2)
  6. In the Request Body (3), enter this payload:
    {   
    
       "serial_no__c": "1001",
       "door_open__c": false,
       "temperature__c": 39 
    
    } 
  7. Click Execute (4) to verify that there are no errors. If there are no errors, you see “success: true” below the request body. (5)Workbench with specified settings, URL, and payload
  8. If you get errors, try changing the URL or the syntax of the payload, and try again.

Now, back in Salesforce, you can check the Traffic view of your orchestration and see that there is one instance in the Default state, which means that the refrigerator temperature does not exceed the maximum. Your orchestration looks like this. Flying Fridge Maintenance orchestration with one instance in the Default state

Now we use Workbench again to send an event with a high temperature. The event causes the instance to move to the High Temperature state, which triggers an automatic case creation.

Repeat the steps above for sending the event, but change the temperature from 39 to 55. The payload looks like this.

{

   "serial_no__c": "1001",
   "door_open__c": false,
   "temperature__c": 55 

} 

If you can, arrange your two browser windows—one for Workbench, and the other for your orchestration’s traffic view—so you can view them side by side. When you click Execute in Workbench and it sends the event to your orchestration, after a few seconds you see the instance move to the High Temperature state. Your Orchestrations screen looks like this. Flying Fridge Maintenance orchestration with one instance in the High Temperature state

That’s super cool, but what’s even cooler is that when the fridge entered the High Temperature state, a service case was created automatically. Let’s check that out.
  1. Click app launcherto open the App Launcher, and then click Service.
  2. Click the Cases dropdown.
  3. Under Recent Cases, you see your new case created by Salesforce IoT.
New case created by Salesforce IoT

We can see that everything is working as intended, and now you have the skills to start building out your own Salesforce IoT solutions. Of course there are many more options than what you worked through in this module, but now you know what’s possible.

We hope you enjoyed your flight today. Keep exploring the world of Salesforce IoT.

Resources

retargeting