Example: Using Dynamics 365 CRM Actions
Let us say we have a requirement to configure an alert to get customer asset status code, and then send an SMS to the operator.
1. Use ThingWorx trigger to configure an alert
2. Get customer asset status code using ThingWorx and Dynamics 365 CRM actions
3. Send an SMS to the operator using Twilio
Use ThingWorx Trigger to Configure an Alert
Let us set up a ThingWorx trigger that fires off each time a new alert is created in the ThingWorx account.
1. Place the pointer on the start icon, and then click or double-click the start icon. A list of triggers appears.
2. Select the ThingWorx trigger, and then create a new event. The ThingWorx trigger configuration window opens.
* 
If a trigger is already created, select the existing trigger, and then click SAVE. To create a new trigger, click Create a new event for ThingWorx, and then proceed with the steps further.
3. Enter the information in the trigger configuration window, and then click SAVE.
Get Customer Asset Status Code from ThingWorx and Dynamics 365 CRM
We will now configure the Get Thing Properties action in ThingWorx and Get Records action in Dynamics 365 CRM. Whenever a new alert is created, you get the customer asset code automatically. To configure the Get Thing Properties action and Get Records action, do the following:
1. Drag the Get Thing Properties action under the ThingWorx connector to the canvas, place the pointer on the action, and then click or double-click the action. The Get Thing Properties action window opens.
2. In the Get Thing Properties action window, enter the information that follows:
a. In the Find By list, select Selection.
b. In the Thing field, select a Thing on which the property is to be set. A list for first 500 items is displayed. To view more items, click LOAD MORE.
* 
For the Thing, Template, or Shape lookups, first 2000 items are queried and if the item that is searched for is not in the list, then apply an initial filtering to get the item in the result set.
c. In the Property field, select the assetId property to get the asset information.
d. Click Done.
3. Drag the Get Records action under the Dynamics 365 CRM connector to the canvas, place the pointer on the action, and then click or double-click the action. The Get Records action window opens.
4. In the Get Records action window, enter the information that follows:
a. In the Find By list, select Query.
b. In the Entity Set list, select Customer Asset.
c. In the Filters section, select a Join By operator as and.
d. Add a property to match the property value such that the Customer Asset ID equals {{$a0.DynamicsThing[0].assetId}}. You can map the DynamicsThing under the trigger data section to the property value field (shown in the above figure).
5. Click Done.
Send an SMS to the Operator using Twilio
We will configure the Send an SMS action in Twilio. Once you get the customer asset code, the operator is notified and receives an SMS. To configure the Send an SMS action, do the following:
1. Drag the Send an SMS action under the Twilio connector to the canvas, place the pointer over the action, and then click or double-click the action. The Send an SMS action window opens.
2. In the To Number field, enter the destination phone number with plus sign and country code. If you do not provide the plus sign and country code, Twilio uses the same country code from the From Number field.
3. In the From Number field, enter the Twilio phone number or alphanumeric sender ID enabled for the type of message to send. The phone numbers or short codes purchased from Twilio work here. For example, you cannot spoof messages from your own cell number.
4. In the Message field, enter the text message to send. You can map the Customer asset information under the trigger data to this field.
5. Click Done.
Was this helpful?