Wednesday 21 December 2011

CRM4 primary character limit

Issues:
This morning I received an error from generic SQL error when a process tried to update an account record. The details error log looks like this:
>Exception when executing non-query: update ActivityPointerBase set RegardingObjectIdName='<<A very long account name>>' where (RegardingObjectId = '5cc47836-4867-e011-8520-005056860020' and RegardingObjectTypeCode = 1) Exception: System.Data.SqlClient.SqlException: String or binary data would be truncated.
 When I look in the error, it suggests the name is too long to be put in the reference object table. I checked the name attribute in account; it is set to 450 characters. However when I look at the database table RegardingObjectName is set to 400. When it try to inset the name it errors out.

Conclusion and lesion learn:
The character limits of primary attribute in CRM is 400. This apply to both CRM 4 and CRM 2011. To fix this simply truncate the name to 400 characters and update the attribute in account to 400 characters.

No comments:

Post a Comment