Question

I'm trying to change ZIP/Postal Code field length. I've changed Maximum Length from 20 to 100 chars, saved customization and published it. But when I'm trying to save or update the record on CRM form with Postal Code larger than 50 chars I'm getting error:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault,
Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, 
PublicKeyToken=31bf3856ad364e35]]: Generic SQL error.Detail: 
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147204784</ErrorCode>
<ErrorDetails 
    xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Generic SQL error.</Message>
    <Timestamp>2013-10-04T13:57:19.13039Z</Timestamp>
    <InnerFault i:nil="true" />
    <TraceText i:nil="true" />
</OrganizationServiceFault>

Same thing when updating record with CrmOrganizationServiceContext. Thanks in advance.

Was it helpful?

Solution

You are not able to store more than 50 characters in the postalcode field, no matter what is configured in the user interface. To be clear, the user interface will let you enter a large field size (in your case 100) but the field in the underlying SQL database (CustomerAddressBase.PostalCode) will not grow beyond 50, even if you customize the Address entity to make the field size larger.

Not sure if this is intentional by design or a bug in Dynamics CRM, you would need to contact Microsoft to determine if it can be fixed. I can tell you that this does not appear to be documented anywhere in the CRM SDK documentation for the CustomerAddress entity.

I tested this in an on-premises installation and it has has the same issue.

OTHER TIPS

Are you using Early Bound Entity Classes? If so you will need to rebuild them using crmsvutil.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top