Implementer Comment over 254 characters will throw an error.

book

Article ID: 171113

calendar_today

Updated On:

Products

ServiceDesk

Issue/Introduction

In the last part of the Change process, in 'Implement Change Task',  when you select action 'Complete Task', the only field on the form that opens is the required 'Provide Comments' multiline textbox. If the length of comment entered exceeds 254 characters, an Application Error is shown and the Change ticket will not progress further.

Error System.Exception: could not save object Symantec.ServiceDesk.Cm.Core.DataTypes.ChangeTicket ---> System.Data.SqlClient.SqlException: String or binary data would be truncated.
The statement has been terminated.
в System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
в System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
в System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
в System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
в System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
в System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
в System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
в System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
в LogicBase.Core.Messaging.Implementations.UpdateStatement.Execute(SqlConnection conn, SqlTransaction tr)
в LogicBase.Core.Messaging.Implementations.InsertOrUpdateStatement.RunUpdateStatement(SqlConnection conn, SqlTransaction tr)
в LogicBase.Core.Messaging.Implementations.InsertOrUpdateStatement.Execute(SqlConnection conn, SqlTransaction tr)
в LogicBase.Core.Messaging.Implementations.RelationalMapperExchange.SaveObjectRunSQL(List`1 statements)
в LogicBase.Core.Messaging.Implementations.RelationalMapperExchange.SaveObject(Object o, Boolean retryDeadlock)
в LogicBase.Core.Messaging.Implementations.RelationalMapperExchange.SaveObject(Object o, Boolean retryDeadlock)
в Symantec.ServiceDesk.Cm.Core.ChangeManagementDataService.CreateOrUpdateChangeRequest(ChangeTicket changeTicket)
в LogicBase.Core.ExecutionEngine.SinglePathProcessComponentExecutionDelegate.Execute(IData data, IOrchestrationComponent comp, String& outputPath, IExecutionEngine engine, TLExecutionContext context)
в LogicBase.Core.ExecutionEngine.AbstractExecutionEngine.RunComponent(TLExecutionContext context, IData data, IOrchestrationComponent comp)

Cause

The Database schema for the Change Ticket defines Implementer Comments with length of 254 characters, and the form does not check length of the comments entered before trying to save it into database.

Text entered there will be saved to the CmChangeTicket table in the database. CmChangeTicket.ImplementerComments type is nvarchar(254), anything over 254 characters will trigger the SQL exception.

Environment

ServiceDesk 8.0
ServiceDesk 8.1 up to and including RU5

Resolution

The database field will be extended in ServiceDesk 8.1 RU6 to resolve this issue.

Workaround:

A good workaround to this is to add a check to the forms project for field length. The problem is in SD.Forms.ChangeManagement project than is open and customizable. Fairly simple logic can be added to the project to check and warn about the comment length at the top of the form. 


SD.Forms.ChangeManagement project > Model: Implementation
'Fulfill Change Ticket' dialog > 'Completed' output path

1. Add 'Get Text Length' component
- Input Variable Name: NewChangeRequest.ImplementerComments
- Length Variable Name: ImplementerCommentsLength

2. 'Compare Numbers Rule' component
- Value 1: Process Variables: ImplementerCommentsLength
- Value 2: Constant Value: 254
Connect 'less than' and 'equal to' paths to 'Check Tasks' component.
Connect 'greater than' path back to 'Fullfill Change Ticket'

3. Add 'Merge Text' component on that path from 'greater than' to 'Fullfill Change Ticket'.
Variable Name: VarStatusMessage
Merge Data:
Add a message to be shown at the top of the page when comment is too long. For example:
'Please keep the comment under 254 characters (currently [ImplementerCommentsLength])'