D365 Error · Dynamics 365 WEB API

{Alternate Key Limitation}Performing updates using alternate key in Dynamics 365 WebAPI

While updating CRM record using alternate key from Web API which has unicode character in field data, It throws Bad request exception.

new_ANGLESector@odata.bind”: “/new_anglesectors(new_name=’Water Auth/Company’)”,


message”: “Bad Request – Error in query syntax.”, “type”: “Microsoft.OData.ODataException”, “stacktrace”: ” at Microsoft.OData.UriParser.ODataPathParser.ExtractSegmentIdentifierAndParenthesisExpression(String segmentText, String& identifier, String& parenthesisExpression)

Unicode characters in key value

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.

We do have other limitations while using Alternate Key

Fields that can be used for alternate keys

Only these kinds of fields can be used to create alternate keys:

  • Decimal
  • Whole Number (Integer)
  • Single line of Text (String)
  • Date and Time
  • Lookup
  • Option Set

Number of keys

You can define up to five different keys for an entity.

Valid key size

When a key is created, the system validates that the key can be supported by the platform, including that the total key size does not violate SQL-based index constraints like 900 bytes per key and 16 columns per key. If the key size doesn’t meet the constraints, an error message will be displayed.

Hope this helps!


One thought on “{Alternate Key Limitation}Performing updates using alternate key in Dynamics 365 WebAPI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s