Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}. (Fault Detail is equal to Exception details: ErrorCode: 0 {2}

Posted on by 5

In production environment,customer is using Microsoft Dynamics 365 2020 release wave 2 enabled, version 1710(9.1.0.23466) online..They're getting below exception when inserting a record in an entity that is created from our .net code.We're using IOrganizationservice.create(entity) to insert a record.DCRM does client side validation and gives a validation error when we try to insert data that is longer than that of field length.Can anyone help to find out the cause of this exception?

System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}. (Fault Detail is equal to Exception details:
ErrorCode: 0x80090429
Message: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}.

  • ordaxtryin Profile Picture
    ordaxtryin 35 on at
    RE: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}. (Fault Detail is equal to Exception details: ErrorCode: 0 {2

    Did you ever resolve this issue? We are facing the exact same problem but as part of Dual Write between F&O and CE, sending from F&O to CE.

  • prathyushamagam Profile Picture
    prathyushamagam 5 on at
    RE: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}. (Fault Detail is equal to Exception details: ErrorCode: 0 {2

    Hi

    After setting the field length to max values in DCRM also,customer is still facing the same exception.Except for a filed,we're not setting field length restrictions in code.

    Code follows:

    public String StoreUnpublishedData(String entityName,String messageName,String data,String listener,String failedInfo)

           {

               try

               {

                   String failedInfo2 = String.IsNullOrWhiteSpace(failedInfo) ? "" : failedInfo;

                   if (failedInfo2.Length > 4000)//in case it is too long

                       failedInfo2 = failedInfo2.Substring(0, 4000);

                   Entity LogEntity = new Entity();

                   LogEntity.LogicalName = "unpublisheddata";

                   LogEntity.Attributes.Add("id",Guid.NewGuid().ToString().Replace("-", ""));

                   LogEntity.Attributes.Add("messageName",messageName);

                   LogEntity.Attributes.Add("entityname",entityName);

                   LogEntity.Attributes.Add("Listener", listener);

                   LogEntity.Attributes.Add("Retries", 0);

                   LogEntity.Attributes.Add("failedInfo",failedInfo2);

                   LogEntity.Attributes.Add("data", data);

                   m_ctx.OrganizationService.Create(LogEntity);

                   return newId;

               }

               catch (Exception)

               {

                   throw;

               }

           }

    line m_ctx.OrganizationService.Create(LogEntity) is throwing exception.

    Fields length in DCRM:

    Column Name	           Max Length
    entityname	           100
    messagename	   100
    id	                           100
    failed_info	            4000
    data	                    102400
    listener	            10240
  • Anks27 Profile Picture
    Anks27 1,083 on at
    RE: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}. (Fault Detail is equal to Exception details: ErrorCode: 0 {2

    Hello,

    From the exception details, it is apparent that length of one of the fields exceeds the maximum length specified in Dynamics 365 CRM while creating a record.

    To fix this issue, make sure that length of all fields that you are populating in your code is within the max length limit.

    Signed, Sealed and Delivered.

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

     

    Thanks & Regards,

    Ankit Shah(MCT-Microsoft Certified Trainer)

     

    Follow/Connect 101 on below

    LinkedIn:-   https://linkedin.com/in/dynamicpower101/

    Twitter:-     https://twitter.com/Dynamicpower101

    Facebook:- https://facebook.com/DynamicPower101/

    Telegram:- https://t.me/dynamicpower101

    Medium:-   https://medium.com/dynamicpower101

  • prathyushamagam Profile Picture
    prathyushamagam 5 on at
    RE: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}. (Fault Detail is equal to Exception details: ErrorCode: 0 {2

    If I try to pass the request with longer field length,I get the following exception as DCRM does the validation,but not the exception customer is facing in their environment."Message: A validation error occurred.  The length of the 'tibco_data' attribute of the 'tibco_unpublisheddata' entity exceeded the maximum allowed length of '100'."I don't have access to code as of now.

  • RE: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: String or binary data would be truncated in table '{0}', column '{1}'. Truncated value: {2}. (Fault Detail is equal to Exception details: ErrorCode: 0 {2

    Hi,

    From the error message it really seems you are sending a request with some field that exceeds the schema field length.

    My advice is to take a look at the code to make sure all field passed are within the schema length.

    If you want you may paste it here so we can take a look at it.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans