Jump to content

Unable to insert record in DCRM in cusotmer environment.Getting String truncation exception.Can anyone help me to reproduce or fix the exception


Prathyusha Magam

Recommended Posts

When creating a record in an entity in DCRM online instance using IOrganizationservice.create() webservice method in c# code, we're getting the following exception in production envirnoment,though the data length in fields are within the DCRM schema allowed limit..

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}.

If data in fields islonger than the allowed field length of DCRM schema,I get exception as StringLengthTooLong but not the truncation exception.Can anyone help me to reproduce the truncation exception in DCRM

This link https://support.tibco.com/s/article/Replication-Services-Error-Failed-to... has mentioned steps to reproduce the exception.But,when I follow the steps,I don't get an exception.

Following code is used to create a record in UnpublishedData entity:

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;

}

}

Fileds in UnpublishedData entity:

Column Name Max Length

entityname 100

messagename 100

id 100

failed_info 4000

data 102400

listener 10240

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...