HI Alexander,
Thank you for your response. I tried out the approach # 1 you mentioned above where I tried to build additional logic in the logic app "IoT-to-CRM" which comes out of the box during the installation of connected field services solution with an IoT Hub architecture.
After IoT alert is created in the Logic App, I used the IoT Alert ID to create a work order if the reading value is over threshold (indicating criticality).
However, this gave a 400 error. Would you be able to advise what the issue might be ? The error was:
{
"status": 400,
"message": "Bad Request - Error in query syntax.",
"source": "orgxxxxxxx.crm.dynamics.com",
"errors": [],
"debugInfo": "clientRequestId: c8aaa60d-2dcb-42cb-9161-7bc88a6af5c0"
}
Here's the input to creating a new record in work orders using Common Data Service:
{
"method": "post",
"path": "/v2/datasets/orgxxxxxxx.crm/tables/msdyn_workorders/items",
"host": {
"connection": {
"name": "/subscriptions/XXXXXXX/resourceGroups/rg-XXXXX/providers/Microsoft.Web/connections/commondataservice"
}
},
"body": {
"_msdyn_billingaccount_value": "XXXXX",
"_msdyn_customerasset_value": null,
"_msdyn_iotalert_value": "9297aac7-ddb8-e911-a989-000d3a3acafd",
"_msdyn_pricelist_value": "Office 365 USA (sample)",
"_msdyn_primaryincidenttype_value": "Some Incident Happened",
"_msdyn_priority_value": "Urgent",
"_msdyn_serviceaccount_value": "XXXXXX",
"_msdyn_serviceterritory_value": "United States",
"_msdyn_workordertype_value": "IoT-predictive maintenance",
"msdyn_ismobile": true,
"msdyn_latitude": 39.742043,
"msdyn_longitude": -104.991531,
"msdyn_name": "27919",
"msdyn_primaryincidentdescription": "Some Incident Happened",
"msdyn_systemstatus": 690970000,
"msdyn_taxable": false,
"msdyn_worklocation": 690970000,
"msdyn_workordersummary": "Some Incident Happened, creating automated work order"
}
}
Thank you so much.
Regards,
Puneet