使用 Azure 逻辑应用程序在 Dynamics 365 Connected Field Service 中创建新记录
Create a new record in Dynamics 365 Connected Field Service using Azure LogicApps
我正在尝试在 Dynamics 365 Connected Field Service 中创建新记录。我在流分析中创建了一个查询,它将设备数据发送到队列。
例如,在 Azure LogicApps 中,负载消息如下所示
{"Device":"ESP8266","AccValue":21168,"Location":"$GPRMC ..."}
此消息使用 parseJSON 进行解析,以便我可以从负载中提取每个字段。在下一个创建新记录的函数中,我可以简单地使用描述列的 AccValue 和 Location。但是,当我尝试将 Device 参数设置为 Device 时,出现此错误:
{
"status":
400,
"message":
"An error occurred while validating input parameters: Microsoft.OData.ODataException: A 'PrimitiveValue' node with non-null value was found when trying to read the value of the property 'msdyn_Device'; however, a 'StartArray'
node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected.\r\n at Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ValidateExpandedNestedResourceInfoPropertyValue(IJsonReader jsonReader, Nullable`1 isCollection,
String propertyName)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithValue(IODataJsonLightReaderResourceState resourceState, String propertyName, Boolean isDeltaResourceSet)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.<>c__DisplayClass9_0.<ReadResourceContent>b__0(PropertyParsingResult
propertyParsingResult, String propertyName)\r\n at Microsoft.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(PropertyAndAnnotationCollector propertyAndAnnotationCollector, Func`2 readPropertyAnnotationValue, Action`2 handleProperty)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadResourceContent(IODataJsonLightReaderResourceState
resourceState)\r\n at Microsoft.OData.JsonLight.ODataJsonLightReader.StartReadingResource()\r\n at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtStartImplementationSynchronously(PropertyAndAnnotationCollector propertyAndAnnotationCollector)\r\n at Microsoft.OData.ODataReaderCore.ReadImplementation()\r\n
at Microsoft.OData.ODataReaderCore.InterceptException[T](Func`1 action)\r\n at System.Web.OData.Formatter.Deserialization.ODataReaderExtensions.ReadResourceOrResourceSet(ODataReader reader)\r\n at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.Read(ODataMessageReader
messageReader, Type type, ODataDeserializerContext readContext)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)",
"source":
"x.crm4.dynamics.com",
"errors": [],
"debugInfo":
"clientRequestId: 03d448c2-e6fe-4bac-b6c4-19328bc2b1bb"
}
如果我省略 'Device' 参数,IoT 警报将列在 D365 CFS 中:
应该在 Dynamics 365 Connected Field 中新创建包含 GPS 和 AccValue 列 "description" 以及列 "Device" 设备名称 (ESP8266) 的记录服务。它已经注册到物联网中心并正确发送数据。
有什么办法可以解决这个问题?
当您在 CDS 中有导航 属性(关系)并试图向它发送原始值(int、字符串等)时,会发生此错误。它需要一个实体或实体数组。
您需要根据相应定义交叉检查您发送的负载中的 属性 值。正在发送的一个或多个属性是针对某个关系的,并且具有不正确的值。
"message":
“验证输入参数时发生错误:Microsoft.OData.ODataException:尝试读取 属性 'msdyn_Device' 的值时发现具有非空值的 'PrimitiveValue' 节点;但是,预期 'StartArray' 节点、'StartObject' 节点或具有空值的 'PrimitiveValue' 节点。\r\n at
我正在尝试在 Dynamics 365 Connected Field Service 中创建新记录。我在流分析中创建了一个查询,它将设备数据发送到队列。
例如,在 Azure LogicApps 中,负载消息如下所示
{"Device":"ESP8266","AccValue":21168,"Location":"$GPRMC ..."}
此消息使用 parseJSON 进行解析,以便我可以从负载中提取每个字段。在下一个创建新记录的函数中,我可以简单地使用描述列的 AccValue 和 Location。但是,当我尝试将 Device 参数设置为 Device 时,出现此错误:
{
"status":
400,
"message":
"An error occurred while validating input parameters: Microsoft.OData.ODataException: A 'PrimitiveValue' node with non-null value was found when trying to read the value of the property 'msdyn_Device'; however, a 'StartArray'
node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected.\r\n at Microsoft.OData.JsonLight.ODataJsonLightPropertyAndValueDeserializer.ValidateExpandedNestedResourceInfoPropertyValue(IJsonReader jsonReader, Nullable`1 isCollection,
String propertyName)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithValue(IODataJsonLightReaderResourceState resourceState, String propertyName, Boolean isDeltaResourceSet)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.<>c__DisplayClass9_0.<ReadResourceContent>b__0(PropertyParsingResult
propertyParsingResult, String propertyName)\r\n at Microsoft.OData.JsonLight.ODataJsonLightDeserializer.ProcessProperty(PropertyAndAnnotationCollector propertyAndAnnotationCollector, Func`2 readPropertyAnnotationValue, Action`2 handleProperty)\r\n at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadResourceContent(IODataJsonLightReaderResourceState
resourceState)\r\n at Microsoft.OData.JsonLight.ODataJsonLightReader.StartReadingResource()\r\n at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtStartImplementationSynchronously(PropertyAndAnnotationCollector propertyAndAnnotationCollector)\r\n at Microsoft.OData.ODataReaderCore.ReadImplementation()\r\n
at Microsoft.OData.ODataReaderCore.InterceptException[T](Func`1 action)\r\n at System.Web.OData.Formatter.Deserialization.ODataReaderExtensions.ReadResourceOrResourceSet(ODataReader reader)\r\n at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.Read(ODataMessageReader
messageReader, Type type, ODataDeserializerContext readContext)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger)",
"source":
"x.crm4.dynamics.com",
"errors": [],
"debugInfo":
"clientRequestId: 03d448c2-e6fe-4bac-b6c4-19328bc2b1bb"
}
如果我省略 'Device' 参数,IoT 警报将列在 D365 CFS 中:
应该在 Dynamics 365 Connected Field 中新创建包含 GPS 和 AccValue 列 "description" 以及列 "Device" 设备名称 (ESP8266) 的记录服务。它已经注册到物联网中心并正确发送数据。
有什么办法可以解决这个问题?
当您在 CDS 中有导航 属性(关系)并试图向它发送原始值(int、字符串等)时,会发生此错误。它需要一个实体或实体数组。
您需要根据相应定义交叉检查您发送的负载中的 属性 值。正在发送的一个或多个属性是针对某个关系的,并且具有不正确的值。
"message": “验证输入参数时发生错误:Microsoft.OData.ODataException:尝试读取 属性 'msdyn_Device' 的值时发现具有非空值的 'PrimitiveValue' 节点;但是,预期 'StartArray' 节点、'StartObject' 节点或具有空值的 'PrimitiveValue' 节点。\r\n at