Hey,
While creating a lead, I get a weird Exception.
As soon as the subject field exceeds 51 chars a SQLException is thrown. But in CRM the maximum length of this field is set to 300 chars.
Has anyone an idea?
System: CRM-Online
Early/latebound: Earlybound
{Exception details: ErrorCode: 0x80073001 Message: Sql error: A validation error occurred. A string value provided is too long. CRM ErrorCode: -2147012607 Sql ErrorCode: -2146232060 Sql Number: 8152 TimeStamp: 2019-06-17T09:54:28.1568230Z -- Exception details: ErrorCode: 0x80073001 Message: Sql error: A validation error occurred. A string value provided is too long. CRM ErrorCode: -2147012607 Sql ErrorCode: -2146232060 Sql Number: 8152 TimeStamp: 2019-06-17T09:54:28.1568230Z -- Exception details: ErrorCode: 0x80073001 Message: Sql error: A validation error occurred. A string value provided is too long. CRM ErrorCode: -2147012607 Sql ErrorCode: -2146232060 Sql Number: 8152 TimeStamp: 2019-06-17T09:54:28.1568230Z -- Exception details: ErrorCode: 0x80040216 Message: Exception output:: System.Data.SqlClient.SqlException (0x80131904): String or binary data would be truncated. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.Crm.CrmDbConnection.LockConnectionAndExecuteMethod[TResult](IDbConnection connection, Func`1 executeMethod) at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command, ICrmTransaction crmTransaction) at Microsoft.Crm.CrmDbConnection.<>c__DisplayClass122_0.<InternalExecuteNonQuery>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.Platform.Server.DataEngine.SqlDataAccessManager.ExecuteNonQuery(IDbCommand command, ISqlExecutionContext context, Int32 sourceLineNumber, String memberName, String sourceFilePath) at Microsoft.Crm.Platform.Server.DataEngine.EntityCrudManager.Create(IBusinessEntity entity, ExecutionContext context) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.DoCreate(IBusinessEntity entity, ExecutionContext context) ClientConnectionId:419f89ff-ca05-4488-82f1-b3fd286dbb7c Error Number:8152,State:13,Class:16 ClientConnectionId before routing:dc443f59-ff1a-44ed-b79c-078a9fce65bf Routing Destination:e6c362a837bc.tr641.northeurope1-a.worker.database.windows.net,11042 Error(s) details: Class: 0x10 LineNumber: 1 Message: String or binary data would be truncated. Number: 8152 Procedure: Server: e6c362a837bc.tr641.northeurope1-a.worker.database.windows.net,11042 Source: .Net SqlClient Data Provider State: 13 ToString(): System.Data.SqlClient.SqlError: String or binary data would be truncated. -- Class: 0x0 LineNumber: 1 Message: The statement has been terminated. Number: 3621 Procedure: Server: e6c362a837bc.tr641.northeurope1-a.worker.database.windows.net,11042 Source: .Net SqlClient Data Provider State: 0 ToString(): System.Data.SqlClient.SqlError: The statement has been terminated. -- : Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #F01E7DEE TimeStamp: 2019-06-17T09:54:28.1568230Z -- }
*This post is locked for comments
Thank you very much for your help!
Somehow the FirstName of the lead is set to the subject name, if it is null during create.
Regards
Andreas
Hi
The 50 chars limit is for names fields like First Name, Last Name, and Middle Name. Make sure you are not setting longer values to these fields.
The error message does not have the details on which field exceeded the limit.
I would enable plugin trace log in CRM and see if you could find more error details around to see which field the error is referring to.
If the plugin trace log does not have any meaningful message, I would check if there are any processes in CRM plugin / real-time workflow that copies lead the subject into any other field that has a max limit set to 50 chars.
In your client side code, try setting value only to subject field and leave all other blank and try to create and see if it fails to rule out it's not caused by you setting the longer value to other fields.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156