通过 Web API 在 Dynamics CRM Online 中创建记录时未声明 [=11=]
Undeclared property when creating a record via Web API In Dynamics CRM Online
我正在尝试使用自定义查找字段在 Dynamics CRM Online 中创建一个实体。即使在提供了这里提到的 SchemaName(sg_DepartmentalProjectId) 之后 我仍然遇到同样的错误。
验证输入参数时发生错误:Microsoft.OData.ODataException:未声明的 属性 'sg_DepartmentalProjectId' 有效载荷中只有 属性 注释但没有 属性在有效负载中找到值。在 OData 中,只有声明的导航属性和声明的命名流可以表示为没有值的属性。
下面是我的JSONPost
{
"sg_invoicenumber": "SIAIR402742-416805",
"sg_accountnumber": "5400",
"sg_description": "xxxx",
"sg_fy": "20",
"sg_name": "Operational Journal: yyy - 09/20/2019",
"sg_departmentid": "CC10530",
"sg_postingdate": "2019-09-20",
"sg_invoicedate": "2019-09-20",
"sg_checkdate": "2019-09-20",
"sg_paidfulldate": "2019-09-24",
"sg_amount": 5597.4,
"sg_effectivedate": "2019-09-20",
"sg_DepartmentalProjectId@odata.bind":"/sg_departmentalmatters(e9c31cec-deff-e411-80c5-0050569732ae)"
}
请 from the Developer resources & verify the exact casing. Jason Lattimer also confirmed调查 CRM REST 构建器问题时的错误:
I've come to figure out the metadata is in fact not the source of truth - it's the CSDL
我知道当它以不同的方式工作并通过不同的解决方案解决时,这非常烦人。确保在所有这些地方验证自定义查找属性。
我遇到了同样的问题,但在我的例子中使用架构名称不起作用。我相信这是因为我的字段被设置为导航 属性 到两个不同实体中的任何一个。我通过从 API 中提取实体的元数据并查看导航属性找到了正确的名称。为此字段定义了两个导航属性,每个目标实体一个,所以我必须在我的有效负载中使用正确的名称。
<NavigationProperty
Name="parentcustomerid_account"
Type="mscrm.account"
Nullable="false"
Partner="contact_customer_accounts">
<ReferentialConstraint
Property="_parentcustomerid_value"
ReferencedProperty="accountid" />
</NavigationProperty>
上面的 parentcustomerid_account
是正确的值。
我有同样的问题
JSON:
{
"activityid": "cbf73794-9e42-ec11-8c62-00224815945f",
"subject": "Test 22",
"new_AppointmentTypeId@odata.bind": "new_tasktypes(a97ec3cf-3e1a-ea11-a811-000d3a799417)"
}
我得到的错误:
An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'new_AppointmentTypeId' 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.
分辨率:
从元数据浏览器中查找 ReferencingEntityNavigationProperty 以获得您需要的字段。
工作JSON:
{
"activityid": "cbf73794-9e42-ec11-8c62-00224815945f",
"subject": "Test 22",
"new_AppointmentTypeId_Appointment@odata.bind": "new_tasktypes(a97ec3cf-3e1a-ea11-a811-000d3a799417)"
}
我正在尝试使用自定义查找字段在 Dynamics CRM Online 中创建一个实体。即使在提供了这里提到的 SchemaName(sg_DepartmentalProjectId) 之后
验证输入参数时发生错误:Microsoft.OData.ODataException:未声明的 属性 'sg_DepartmentalProjectId' 有效载荷中只有 属性 注释但没有 属性在有效负载中找到值。在 OData 中,只有声明的导航属性和声明的命名流可以表示为没有值的属性。
下面是我的JSONPost
{
"sg_invoicenumber": "SIAIR402742-416805",
"sg_accountnumber": "5400",
"sg_description": "xxxx",
"sg_fy": "20",
"sg_name": "Operational Journal: yyy - 09/20/2019",
"sg_departmentid": "CC10530",
"sg_postingdate": "2019-09-20",
"sg_invoicedate": "2019-09-20",
"sg_checkdate": "2019-09-20",
"sg_paidfulldate": "2019-09-24",
"sg_amount": 5597.4,
"sg_effectivedate": "2019-09-20",
"sg_DepartmentalProjectId@odata.bind":"/sg_departmentalmatters(e9c31cec-deff-e411-80c5-0050569732ae)"
}
请
I've come to figure out the metadata is in fact not the source of truth - it's the CSDL
我知道当它以不同的方式工作并通过不同的解决方案解决时,这非常烦人。确保在所有这些地方验证自定义查找属性。
我遇到了同样的问题,但在我的例子中使用架构名称不起作用。我相信这是因为我的字段被设置为导航 属性 到两个不同实体中的任何一个。我通过从 API 中提取实体的元数据并查看导航属性找到了正确的名称。为此字段定义了两个导航属性,每个目标实体一个,所以我必须在我的有效负载中使用正确的名称。
<NavigationProperty
Name="parentcustomerid_account"
Type="mscrm.account"
Nullable="false"
Partner="contact_customer_accounts">
<ReferentialConstraint
Property="_parentcustomerid_value"
ReferencedProperty="accountid" />
</NavigationProperty>
上面的 parentcustomerid_account
是正确的值。
我有同样的问题 JSON:
{
"activityid": "cbf73794-9e42-ec11-8c62-00224815945f",
"subject": "Test 22",
"new_AppointmentTypeId@odata.bind": "new_tasktypes(a97ec3cf-3e1a-ea11-a811-000d3a799417)"
}
我得到的错误:
An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'new_AppointmentTypeId' 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.
分辨率:
从元数据浏览器中查找 ReferencingEntityNavigationProperty 以获得您需要的字段。
工作JSON:
{
"activityid": "cbf73794-9e42-ec11-8c62-00224815945f",
"subject": "Test 22",
"new_AppointmentTypeId_Appointment@odata.bind": "new_tasktypes(a97ec3cf-3e1a-ea11-a811-000d3a799417)"
}