Error when executing SmartObject: "Cannot create a row of size (number) which is greater than the allowable maximum row size of 8060"
kbt161639
PRODUCTIssue
When executing a "Workflow Reporting" SmartObject, you get the following error:
"Cannot create a row of size (number) which is greater than the allowable maximum row size of 8060."
Symptoms
You can trace down the query causing this issue by doing an SQL Profiler Trace, and when you run the query, it will fail in SQL with the exact same error:
"Warning: The maximum length of the row exceeds the permissible limit of 8060 bytes. For some combination of large values, the insert/update operation will fail."
This error is most likely caused by too many datafields in a workflow. When executing the "Workflow Reporting" SmartObject, then the temp table we build up when retrieving the data will exceed the SQL limit. Even if you remove all the K2 bits and just leave the datafields in the query, it still exceeds the limit.
Here are some articles about this limit:
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms143432(v=sql.105)
https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms186981(v=sql.105)
Resolution
Our suggestion would be that you save the information in one or more SmartObjects (perhaps based on an SQL table) and not all in the process definition.
One workaround would be to create a StoredProcedure out of the current "Workflow Reporting" SmartObject. If you use this in a workflow, then you'll have to adjust your code so you can still retrieve the data. Of course, if the structure of the "Workflow Reporting" SmartObject changes in future, then you'll likely see a repeat of the same error.