Error "Conversion failed when converting from a character string to uniqueidentifier."

What do I need to change when I get this error in a workflow load step?

image

Looks like database has a string field while entity has a guid data type?

A stack trace would help to see the details.

ERROR Origam.ServerCore.Controller.AbstractController - Error loading data from table 'EmailTemplate' into entity 'EmailTemplate'
Message: Conversion failed when converting from a character string to uniqueidentifier. Exception was encountered while updating data. For more information see Details.
Origam.OrigamException: Error loading data from table 'EmailTemplate' into entity 'EmailTemplate'
Message: Conversion failed when converting from a character string to uniqueidentifier. Exception was encountered while updating data. For more information see Details.
 ---> Origam.OrigamException: Error loading data from table 'EmailTemplate' into entity 'EmailTemplate'
Message: Conversion failed when converting from a character string to uniqueidentifier. Exception was encountered while updating data. For more information see Details.
 ---> System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting from a character string to uniqueidentifier.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.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.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
   at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at System.Data.SqlClient.SqlDataReader.Read()
   at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
   at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
   at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
   at Origam.DA.Service.DataLoader.Fill() in D:\a\1\s\Origam.DA.Service\AbstractSqlDataService.cs:line 118
ClientConnectionId:820e3904-0858-49b9-b82b-9bf2358b13c9
Error Number:8169,State:2,Class:16
```

Are there any functions used in the entity? Calculated fields? The message comes from the SQL Server so it must be something with the query.

It was caused by an incorrectly modeled data constant used in a like (=) filter for a unique identifier field. The constant was set as type string with value written manually instead of type unique identifier with name looked up by id from the database.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.