gpt4 book ai didi

c# - 使用 Web API 在 CRM 数据库中添加查找 GUID 字段时出现错误请求错误

转载 作者:太空狗 更新时间:2023-10-30 01:29:58 26 4
gpt4 key购买 nike

我想在 CRM 的自定义实体中插入一条新记录,其中一个字段是查找类型,即 new_contactid它依赖于 contact实体。

我也提到了Set Values of all Data Types using Web API in Dynamics CRM Through C# .

我的JSON数据如下:

{
"new_transactionnumber":"114",
"new_transactionamount":650,
"new_transactiondate":"2018-01-29T15:01:00.000Z",
"new_contactid_contact@odata.bind":"/contacts(afb9e006-6be5-e711-80ed-bef806786223)",
"new_moveid_new_move@odata.bind":"/new_moves(896f2dcd-b2fa-e711-80ef-bef806786223)"
}

这里,最后 2 个字段用于查找 GUID。原始字段名称为:

  • new_contactid
  • new_moveid

我在最后添加的是主键的实体名称

如果我遗漏了这里的任何内容,请告诉我。

编辑 1:以下是我在 OData 文件中找到的查找字段的引用:

<NavigationProperty Name="new_contact_new_transaction_contactid" Type="Collection(mscrm.new_transaction)" Partner="new_contactid" />

<Property Name="_new_contactid_value" Type="Edm.Guid">
<Annotation Term="Org.OData.Core.V1.Description" String="ContactId" />
<Annotation Term="Org.OData.Core.V1.Computed" Bool="true" />
<Annotation Term="Org.OData.Core.V1.Permissions">
<EnumMember>Org.OData.Core.V1.PermissionType/Read</EnumMember>
</Annotation>
</Property>

<NavigationProperty Name="new_contactid" Type="mscrm.contact" Nullable="false" Partner="new_contact_new_transaction_contactid">
<ReferentialConstraint Property="_new_contactid_value" ReferencedProperty="contactid" />
</NavigationProperty>

<NavigationPropertyBinding Path="new_contact_new_transaction_contactid" Target="new_transactions" />

<NavigationPropertyBinding Path="new_contactid" Target="contacts" />

编辑 2:这些查找字段是绑定(bind)到其他现有实体主键的 GUID。

最佳答案

基本上,导航属性将使用架构名称(Camel 大小写)而不是逻辑名称(pascal 大小写)。

请引用this blog post中的评论评论部分并适当更改:

Please follow the steps listed below :

Step 1 : Goto Cutomization  Developer Resource.

Step 2 : Click to “Download Odata Metadata” link and Download the same.

Step 3 : Once Download, open it and find out name of lookup attribute ( i.e. “new_qualifiedleadid”) and check its casing.

Step 4 : Verify it with the value which you are setting in the code it should be same.

关于c# - 使用 Web API 在 CRM 数据库中添加查找 GUID 字段时出现错误请求错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48502747/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com