Share This Post

Dynamics 365 CFS with Azure IOT

In this Article, we are going to discuss the Dynamics 365 CFS (Connected Field Service) Working with Azure IOT.

Using IoT Central with Dynamics 365 CFS Overview

Microsoft IoT Central is a software as a service (SaaS) solution that abstracts multiple numbers of the low-level components of an Internet of Things (IoT) solution into a customizable model-based approach. The solution is a set up in Microsoft IoT Central, at a similar level of abstraction to what’s done in Microsoft Dynamics 365 applications. Currently, you can use the Microsoft IoT Central with Dynamics 365 CFS by implementing some of your own flows. The upcoming release of the Dynamics 365 will include a directly supported action from the rules that you build in Microsoft IoT Central.

The following illustration highlights the division of work between Microsoft IoT Central, Dynamics 365 CFS, and the core features of the Microsoft Dynamics 365 CFS application.

Dynamics 365 CFS

Division of Work

A key difference in the Microsoft IoT Central deployment is that, although the components of Microsoft Azure IoT Hub are present, they aren’t available for direct extension. All customizations are done via Microsoft IoT Central abstractions. You’ll use the Microsoft IoT Central portal to define and interact with the solution that you build.

To make a solution, you create a Microsoft IoT Central application. To make it easy for you to try this process, a sample application is available. Alternatively, you can create a custom application where you define all device characteristics. In the exercises in this module, you’ll create the custom application for a smart trash container and connect it to Dynamics 365.

When you create an application, the device template defines the behavior and capabilities of the devices.

For example, the device template for our smart trash container might include the state of the lid (open or closed) and another telemetry that’s related to the device.

The following illustration shows that the key components of a device template

Device Template

Device Template

The following table gives you more details about each key template component.

Component Description
Measurements Measurements can be telemetry, which is time series data from the device. Examples involve a state (for example, the lid is open) or an event (for example, the customer presses a button to request trash pickup). Time series information is stored for use by the analytics service. In this case, the analytics service is Azure Time Series Insights.
Properties Properties are device metadata. Examples involve the pickup location for the container, the customer account number, or any other static metadata.
Settings Settings control the behavior of the device. For example, if the container has an odor control feature, a setting can control how active the feature is (high, medium, or low).
Commands Commands let remote commands be sent to the device. When Dynamics 365 CFS is used, the command can be extended into the Dynamics 365 user interface. For example, the command can be sent to force the lid to close if it was left open.
Dashboards Dashboards include tiles that have information about the device. Tiles can include settings, properties, and even maps. For example, you can add a map that shows the location of the device. Such a map might be helpful after a severe weather event that caused trash containers to be blown all over the place.
Rules Rules let you monitor the measurements from device and trigger actions. In our case, rules will let us use Microsoft Flow to generate a Dynamics 365 CFS IoT Alert.

After your template is set up, you can make simulated devices or connect a real device. In the next unit, you’ll build the custom application to manage the smart trash container and then connect it to Dynamics 365 by using the Microsoft Flow IoT Central connector.

Create an IoT Central Application

In this Article, you’ll build an Internet of Things (IoT) solution by using Microsoft IoT Central to integrate with the smart trash containers that are built by Contoso. As part of this Article, you’ll set up the telemetry, including tracking events that are generated when a customer requests on-demand pickup of a container.

Start the Microsoft IoT Central trial

  1. Open the Microsoft Azure portal https://portal.azure.com, and select Create a resource.
Create a resource

Create a resource

2. Search for IoT Central, and select IoT Central Application in the search results.

IoT Central Application

IoT Central Application

3. Select Create.

Create

Create

4. In the Application Name field, enter Smart Trash Can.

5. In the Application URL field, enter a unique URL in the form smarttrashcan<date><initials>.

6. In the Pricing tier field, select Free 30-Day trial.

7. In the Subscription field, select your subscription.

8. Select Create new beneath the Resource group field.

Resource group field

Resource group field

9. In the Name field, specify smarttrashcontainerlab, if it’s available, and then select OK.

smarttrashcontainerlab

smarttrashcontainerlab

10. In the Location field, select a location that’s close to your Microsoft Dynamics 365 location.

11. Select Create.

12. After the deployment is finished, go to the resource, and select the URL in the IoT Central Application URL field.

IoT Central Application URL

IoT Central Application URL

Create a Device Template

  1. Select the Create Device Templates tile.
Create Device Templates

Create Device Templates

2. Enter the Smart Trash Container as the name of the template, and then select Create.

Smart Trash Container

Smart Trash Container

Create a Telemetry Measurement

  1. Select New Measurement.
New Measurement

New Measurement

2. Select Telemetry.

Telemetry

Telemetry

3. In the Display Name field, enter Percent Full.

4. In the Field Name field, enter percent full.

5. In the Units field, enter percent.

6. In the Minimum field, enter 0.

7. In the Maximum field, enter 100.

8. In the Decimal field, enter 0.

9. In the Color field, select any color.

10. Select Save.

Save

Save

Create a State Measurement

  1. Select New Measurement.

2. Select State.

3. In the Display Name field, enter Lid Sate.

4. In the Field Name field, enter lidstate.

5. Select the Add Value button (the plus sign).

Add Value button

Add Value button

6. In the Value field, select Open.

7. In the Display Name field, enter Open.

8. In the Color field, select red.

9. Select the Add Value button (the plus sign).

Add Value button

Add Value button

10. In the Value field, select Closed.

11. In the Display Name field, enter Closed.

12. In the Color field, select green.

select green

select green

13. Select Save.

Select Save

Select Save

Connecting to Connected Field Service

Now that you’ve built a Microsoft IoT Central application, you can connect it to the Connected Field Service by using the Microsoft Flow connectors to register devices and raise alerts with Microsoft Dynamics 365.

Currently, when you install the Connected Field Service add-on, several Microsoft Azure components that aren’t required for the Microsoft IoT Central are installed, because Microsoft IoT Central includes similar components that are packaged as part of the overall service. In the future, we plan to give an installation that doesn’t include these redundant components. The key components that you’ll use to finish the integration are solutions that are installed on the Dynamics 365 side. These components involve entities like IoT Alert and IoT Device. For a real project, you could turn off some of Azure components, like Azure IoT Hub, so that you aren’t billed for them.

Typically, for a Connected Field Service solution, you create customer asset and then register the device. But you can perform the same task by using Microsoft Flow to create a flow for a selected record. In other words, you can either select the customer asset in a list or run the flow from a specific customer asset record. The flow will use Microsoft IoT Central connector to register the device with Microsoft IoT Central (and also with the embedded IoT Hub instance). The following image shows a flow that you’ll use to do the registration. You’ll build this flow in the next unit.

IOT Work Flow

IOT Work Flow

Notice that, in addition to updating the customer asset with a device ID, you’ll create the IoT device record that’s used if you send any commands or other actions from Dynamics 365.

When you register a device, you created a connection between the device in Microsoft IoT Central and the customer asset in Microsoft Dynamics 365 for Field Service. In the previous unit, for the smart trash container scenario, we set up an event to indicate that the container is ready for pickup. Now let’s see how you can raise an alert in the Dynamics 365 so that the container will be scheduled for pickup.

To start the process, we’ll use the feature of Microsoft IoT Central. Rules are built to monitor the telemetry of the device and perform an action when a condition is met. In addition to looking at the real-time values, rules can look at device properties. For example, the properties might add threshold information that varies by device, based on the installation. The following image shows an example of a rule that you’ll build to react to the ready for pickup event. Notice that there are many options for actions when a rule’s conditions are met. In fact, out-of-box Dynamics 365 actions are coming soon. For now, we’ll use Microsoft Flow action to create an IoT Alert record.

Microsoft Flow

Microsoft Flow

To create a flow, you’ll once again use the Microsoft IoT Central flow connector that lets you build a flow that’s triggered by a specific rule in Microsoft IoT Central. The flow itself is quite simple. It matches the customer asset by using a device ID that triggered the flow. An IoT Alert record is then created for each of the matching assets.

IoT Alert record

IoT Alert record

After the IoT Alert is created, it can flow into the normal business process capabilities of Dynamics 365 CFS, including the capabilities for scheduling a visit to the location. In the next unit, you’ll add device registration and raising of alerts to the Microsoft IoT Central application that you built in a previous unit.

Conclusion

In this Article, we dealt with Dynamics 365 CFS (Connected Field Services) and its working with Azure IOT.

Share This Post

Leave a Reply

avatar
  Subscribe  
Notify of
Skip to toolbar