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_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
“message”: “Bad Request – Error in query syntax.”, “type”: “Microsoft.OData.ODataException”, “stacktrace”: ” at 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 he end result was the same.
I’m not being able to overcome this, Any ideias / suggestions ?
Could it be a Bug in D365 API WebApi ?
Best regards, Manuel
Hi!
The request is unsupported:
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.
If you only need uniqueness then this approach will work, but if you need to use these keys as part of data integration then it is best to create the key on fields that won't have data with these characters.
Hi Bipin Kumar
Thanks for the suggestion. The same reply is returned...
Hi,
Can you try below syntax and see if it works.
Water%20Auth%2FCompany
Thanks Aditya ,
However in a integration scenario with external applications, it harder to do it by Id, we would need to know all the possible values for the Id's.
Thanks anyway, it's an option to keep open :)
Hi Mesteves,
I am not sure how alternate keys are assigned in D365
but I know that @odata.bind can be used for the record id as shown below :-
var data={ "alssc_anglesectorid@odata.bind": "/alssc_anglesectors(" + result[_alssc_anglesectorid_value] + ")"}
or
newObj["alssc_anglesectorid@odata.bind"] = "/alssc_anglesectors(" + result["_alssc_anglesectorid_value"] + ")";
Manuel,
The best way is to open a ticket with Microsoft and ask for support - mbs.microsoft.com/.../CRMSupport
Thanks a33ik,
I have tried, and the result is the same :(
"alssc_ANGLESector@odata.bind": "/alssc_anglesectors(alssc_name='Water Auth%2fCompany')",
"message": "Bad Request - Error in query syntax.",
I'm starting to really believe that is a webApi issue. How can I have someone from MSFT to take a look and confirm this problem ?
Best regards,
Manuel
Hello,
Try to replace
’Water Auth/Company’
with
’Water Auth%2fCompany’
according to following post - https://stackoverflow.com/questions/43139878/webapi-with-backslash-2f-in-id-parameter-causes-404-not-found
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156