[英]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.