如何使用 rest API 在 msdynamics 上发送查找字段值?

问题描述

我正在尝试使用 rest API 将查找字段值发送到 msdynamics 。但错误显示如下

请求:

POST /api/data/v9.1/contacts
{
 "parentcustomerid_account@odata.bind": "/accounts(569b6ad2-a122-eb11-a813-000d3a988097)","new_customleadlookup@odata.bind": "/leads(2bdf2161-08b5-43ea-af88-223dbbad2a80)","ownerid@odata.bind": "/systemusers(aef6f417-327b-ea11-a813-000d3a579c6e)
}

回复

{
  "error": {
    "code": "0x0","message": "An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'new_customleadlookup' which only has property annotations in the payload but no property value was found in the payload. In OData,only declared navigation properties and declared named streams can be represented as properties without values.\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadUndeclaredProperty(IODataJsonLightReaderResourceState resourceState,String propertyName,Boolean propertyWithValue)\r\n   at Microsoft.OData.JsonLight.ODataJsonLightResourceDeserializer.ReadPropertyWithoutValue(IODataJsonLightReaderResourceState resourceState,String propertyName)\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.ReadNextnestedInfo()\r\n   at Microsoft.OData.JsonLight.ODataJsonLightReader.ReadAtnestedResourceInfoEndImplementation()\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)"
  }
}

调试时,Msdynamics 接受 schemaName 而不是某些查找字段的逻辑名称。 我在 msdynamics 上创建了两个自定义查找,并尝试使用 Rest API 进行保存。 它接受格式

  1. schemaName@data.bind : /target(id)

  2. logicalName@data.bind: /target (id)

  3. logicalName_entitySchemaName@odata.bind: /target (id)

enter image description here

enter image description here

我们如何找出格式类型 - 哪些字段适用于这些格式。?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...