Plan Your Salesforce IoT Workflows

Learning Objectives

After completing this unit, you’ll be able to:
  • Explain the benefits of a state machine versus a linear workflow engine.
  • Define Salesforce IoT terms.
  • Identify workflow steps in Salesforce IoT.
  • Use the correct syntax in defining actions.

Salesforce IoT Is a State Machine

We hope you’re enjoying your flight. Awhina has settled in for the evening after an amazing day at Dreamforce, but we still have a lot to cover. Since we are done with our in-flight dining, let’s put those tray tables up and get to work.

We’ve talked a bit about how Salesforce IoT is a state machine. As a reminder, a state machine is a nonlinear workflow engine that manages the transitions of objects and people from one defined state to another.

Salesforce IoT helps us create workflows that react to different events and contextual data in nonsequential, organic ways. The great thing about this is, unlike in a linear workflow, you don’t have to define a complete series of sequential steps that cover all possible combinations of events and connected data. We can use Awhina’s panels to illustrate the difference.

The illustration shows just the beginning of what a linear workflow can look like to handle the types of experiences we’ve talked about with Awhina’s panels.

A very complex linear flow chart.

Jeepers! That’s complicated. And, it’s hard to know if we’ve covered all possibilities and permutations.

Now let’s look at how that’s set up in Salesforce IoT using states.

A state workflow view, with three circles representing the states, and arrows from state to state.

It’s like a well-designed, simple series of paths that guide Awhina’s panels from state to state based on whether the panels are healthy (1), have degraded power (2), or are in the process of resetting (3). Within each state, events, conditions, and actions guide Awhina’s panels on their path and create experiences that feel specific to her. In a way that feels like she’s getting the individual attention she needs when she needs it.

Now that we have a lay of the land, let’s take out the inflight magazine to learn some details that can help you understand a little more about Salesforce IoT.

Key Terms

Like any good traveler, if you’re heading to a foreign land, it’s a good idea to learn a few key phrases. We’ve already introduced you to many of these terms, but as you learn more about Salesforce IoT and start working with it, it’s good to have a list of their definitions.
When we say We mean We don’t mean
State machine A nonlinear rules-based engine fueled by real-time events A machine that makes metal state-shaped keepsakes
State A rule or set of rules that are meaningful to the types of people or objects to which they are applied California, Hawaii, or Quintana Roo
Orchestration The composition of rules in various states that create the full experience for your customers or their devices The classical selection on station 5 of your inflight listening entertainment
Rule The logic that tells an orchestration what to do. Rules are made up of events, conditions, actions, and, optionally, transitions. No cutting the security line.
Event Real-time events or periods of time that trigger a rule to be evaluated Dreamforce
Action The part of a rule triggered by an event What the director yells before a scene from Awhina’s Journey
Condition Additional criteria used within a rule. Conditions must be met for a rule to fire. The state of your well-traveled suitcase
Transition A move from one state to another, initiated by a triggering event or condition Getting from your taxi to the gate
Traffic view A graphical representation of how many people or devices are in each state The view from the air traffic control tower

Got all those words underlined in your phrase book? Awesome. Keep that book handy. Consider practicing your new language during the remainder of our flight.

Basic Workflow for Working in Salesforce IoT

Let’s consult our guidebook for the best route through Salesforce IoT. Understanding the basic workflow helps you make the most of your trip.
A flow chart going from left to right, with these five steps: Plan, Connect, Transform, Build, and Deploy.

1. Plan (Plan for Your Trip)

Planning ahead is your best tool for working efficiently and creating the right experiences for your customers.

Start with a deep understanding of your data and by defining what you want to achieve. Ask yourself what events are key to triggering the sets of actions you want to take. Planning ahead is like creating an awesome itinerary. Sometimes you have to stray from it, but it’s a great starting point.

2. Connect (Make That Connection)

Now that we’ve got this amazing itinerary, it’s time to figure out what connections we need to make.

Because you’ve planned well, you know what data sources to connect to in order to run the right data through your states. You can connect to data through clicks or code.

These data sources can be:

  • Streaming events from sensors or apps (for example, power output or temperature)
  • Contextual data about your customer (for example, customer activity or customer records in Salesforce)
  • Third-party data (for example, weather or flight status)

When you connect to this data, you set a key (for example, device_ID) that is shared by all the data sources to connect events with customer and device data.

3. Transform (Pack just what you need)

Salesforce IoT is built to scale, but everything runs more efficiently when you transform your data to meet the needs of your business logic. Not only that, but when you combine event data with contextual data in the right way, it creates meaning for the events. This helps you deliver the right experience for your customer.

Once you’ve transformed your data, you’re ready to start putting together the rules and actions to carry out your business logic, or orchestration.

4. Build (Complete Your Itinerary Details)

OK. We’re ready to fill in those important details of our itinerary. Still have your phrase book handy?

Once you have your states laid out, you need to build in the logic (the rules) that make them take meaningful actions with your customers. This combination of states and logic are orchestrations. Remember, rules are the logic that tell an orchestration what to do. Rules are made up of events, conditions, actions, and, optionally, transitions. Actions are the part of rules triggered by events. You can think of rules as traffic controllers, and actions are the planes taking off and landing triggered by the go-ahead from the air traffic controllers.

When you build your orchestrations, it’s a good idea to follow these guidelines:

  • Build small, test, repeat. Test small increments as you create them. For example, start with a state with just one or two rules, and test that before you move on.
  • More is more. Multiple smaller orchestrations are better than one big one. Use them like building blocks. This enables you to test more easily and makes things more nimble.
  • Make it meaningful. Use meaningful names and descriptions for states, rules, and variables. This helps you and others clearly understand what the orchestration does.

When you build out your states in Salesforce IoT you can use the expression syntax used in formula fields to build out your rules, making it even easier to work with your existing data in Salesforce.

Ready for takeoff? Let’s go!

5. Deploy (Enjoy the Ride)

You’ve planned your trip, figured out your connections, packed your bag, and filled in those important details of your itinerary. Now it’s time to enjoy the ride.

The last step in the Salesforce IoT workflow is deploying what you’ve built. When you put everything into action, you can look at the traffic view to see how many people or devices are in each state. The example below shows the traffic veiw for Awhina’s hotel, The Inn of Things, where she stays when she attends Dreamforce. The hotel uses Salesforce IoT to tailor their customers’ experiences based on their status.

The traffic view in Salesforce IoT, showing the states as circles that get smaller or larger depending on how many people or objects are in the state.

That’s fun to watch, but the most awesome part of putting Salesforce IoT into action is the experience you deliver to your customers and the return you get on your investment in IoT. There’s a simple reason Awhina Oahu loves her Sunshiney Day solar panels. It’s because her experience with the company feels personal. She may not even realize that it’s where a world of connected things (sensors, electronics, and apps) are coming together with the company’s world of customers. But that doesn’t matter. It’s her experience that does, and that’s what keeps her happy and makes her recommend Sunshiney Day to all her friends.

Wow! Our adventure through the land and skies of IoT has been a fun ride. We hope you’ve enjoyed it. Remember, if you want to know more about Salesforce IoT, talk to your Salesforce Account Team. They can let you know if it’s right for you.

retargeting