azure-logic-apps - 使用 Azure LogicApps 在 Dynamics 365 Connected Field Service 中创建新记录
问题描述
我正在尝试在 Dynamics 365 Connected Field Service 中创建新记录。我在流分析中创建了一个查询,它将设备数据发送到队列。
例如,在 Azure LogicApps 中,有效负载消息如下所示
{"Device":"ESP8266","AccValue":21168,"Location":"$GPRMC ..."}
此消息使用 parseJSON 进行解析,以便我可以从有效负载中提取每个字段。在下一个创建新记录的函数中,我可以简单地将 AccValue 和 Location 用于列 Description。但是,当我尝试将 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"
}
如果我省略了“设备”参数,则物联网警报会在 D365 CFS 中列出:
设备及其信息应该是新创建的,作为 Dynamics 365 Connected Field Service 中“描述”列的 GPS 和 AccValue 和“设备”列的设备名称 (ESP8266) 的记录。它已在 IoT 中心注册并正确发送数据。
有什么办法可以解决这个问题?
解决方案
当您在 CDS 中有导航属性(关系)并尝试向其发送原始值(int、字符串等)时,会发生此错误。它需要一个实体或实体数组。
您需要根据相应定义交叉检查您发送的有效负载中的属性值。发送的一个或多个属性用于关系并且具有不正确的值。
“消息”:“验证输入参数时发生错误:Microsoft.OData.ODataException:尝试读取属性“msdyn_Device”的值时发现了具有非空值的“PrimitiveValue”节点;但是,“StartArray”节点、“StartObject”节点或具有空值的“PrimitiveValue”节点。\r\n at
推荐阅读
- reactjs - React 错误:只能在函数组件的主体内部调用挂钩
- kendo-ui - 基于保存的列列表的 KendoGrid 多列标题列重新排序
- java - 如何将 RecyclerView 中显示的数据与 Firebase 中的文档相关联
- scala - 创建包含 SBT 项目+子项目中所有测试的程序集 jar
- typescript - Typescript 中有没有办法使命名空间成为全局的?
- http - JQL 查询中的错误:XXX 是保留的 JQL 字
- sql-server - 在链接服务器问题上使用选择 SQL 删除
- reactjs - 在 react-final-form 中清除表单重置时的 react-datepicker
- jquery - 如何在三元其他部分什么都不做?
- python - selenium.common.exceptions.WebDriverException:消息:服务 /usr/bin/google-chrome 在 Linux 上使用 ChromeDriver Selenium Python 意外退出