简体   繁体   English

在 Dynamics 365 WebAPI 中使用备用键执行更新

[英]Performing updates using alternate key in Dynamics 365 WebAPI

Can anyone help, as I believe someone has already faced the issue I'm having.任何人都可以提供帮助,因为我相信有人已经面临我遇到的问题。

I have a custom entity (alssc_anglesector) with an alternate key (alssc_name)我有一个带有备用键 (alssc_name) 的自定义实体 (alssc_anglesector)

“alssc_ANGLESector@odata.bind”: “/alssc_anglesectors(alssc_name=’Air’)”,
“alssc_ANGLESector@odata.bind”: “/alssc_anglesectors(alssc_name=’Water Auth/Company’)”,

when I create an account and use the first bind with “Air” it works fine, while when using the second “Auth/Company” I got the response当我创建一个帐户并将第一个绑定与“Air”一起使用时,它工作正常,而当使用第二个“Auth/Company”时,我得到了响应

“message”: “Bad Request – Error in query syntax.”, “消息”:“错误请求 - 查询语法错误。”,

“type”: “Microsoft.OData.ODataException”, “类型”:“Microsoft.OData.ODataException”,

“stacktrace”: ” at Microsoft.OData.UriParser.ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression(String segmentText, String& identifier, String& parenthesisExpression) “stacktrace”:“在 Microsoft.OData.UriParser.ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression(String segmentText, String& identifier, String& parenthesisExpression)

I have also tried to encode it我也尝试过对其进行编码

"alssc_ANGLESector@odata.bind": "/alssc_anglesectors(alssc_name=\u0027Water Auth\u002FCompany\u0027)",

but the end result was the same.但最终结果是一样的。

I'm not being able to overcome this, Any ideas / suggestions?我无法克服这个问题,有什么想法/建议吗?

could it be a Bug in D365 API WebApi?这可能是 D365 API WebApi 中的错误吗?

As per the answer in the comment thread: This request is unsupported because it contains Unicode characters根据评论线程中的答案:此请求不受支持,因为它包含 Unicode 字符

Unicode characters in key value Unicode 键值中的字符

If the data within a field that is used in an alternate key will contain one of the following characters <,>,*,%,&,:,/,\ then update or upsert (PATCH) actions will not work.如果在备用键中使用的字段中的数据将包含以下字符之一 <、>、*、%、&、:、/、\,则更新或更新 (PATCH) 操作将不起作用。

The suggestion from the Microsoft Docs is to create another field (such as a code, or a simplified name) that does not contain these characters Microsoft Docs 的建议是创建另一个不包含这些字符的字段(例如代码或简化名称)

https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/define-alternate-keys-reference-records#unicode-characters-in-key-value https://docs.microsoft.com/en-us/powerapps/maker/common-data-service/define-alternate-keys-reference-records#unicode-characters-in-key-value

In this case you have to change 'Water Auth/Company' with 'Water Auth%2FCompany' because of '/' special character.在这种情况下,由于“/”特殊字符,您必须将“Water Auth/Company”更改为“Water Auth%2FCompany”。

I hope it works.我希望它有效。

Ugur乌古尔

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Dynamics 365 Web API使用空备用键检索记录 - retrieve a record using Dynamics 365 Web API with empty alternate key 使用备用键查找 Dynamics 365 实体,该键是 API 的查找属性 - Lookup Dynamics 365 entity with alternate key that is a lookup property with the API Dynamics 365 CE - 如何在 Javascript 中使用 WebApi 取消案例? - Dynamics 365 CE - How to cancel a case using WebApi in Javascript? Dynamics CRM 365 WebApi 8.2 AddListMembersList 方法 - Dynamics CRM 365 WebApi 8.2 AddListMembersList method 在 Kingswaysoft Dynamics 365 Toolkit 中使用 GUID 作为输入执行文本查找 - Performing Text Lookup with GUID as an input in Kingswaysoft Dynamics 365 Toolkit Dynamics Crm 365 webapi - 通过 javascript 发布网络资源 - Dynamics Crm 365 webapi - publish webresource via javascript Dynamics 365 WebApi - BATCH 请求 - 错误 - 消息 header ' ' 无效 - Dynamics 365 WebApi - BATCH request - Error - The message header ' ' is invalid Dynamics 365 WebAPI - 如何让用户访问实体? - Dynamics 365 WebAPI - How to get user access to an entity? 字典中不存在给定的键(动态 365 插件) - The given key was not present in the dictionary (plugin for dynamics 365) Dynamics CRM 365-使用虚拟实体 - Dynamics CRM 365 - Using Virtual entities
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM