We recently upgraded K2 blackpearl to version 4.6.8 as part of a big system upgrade for a UK defence customer. The K2 upgrade went well, and we only encountered one issue that I want to share a solution for.
After refreshing the SQL Server Instance post-upgrade using the K2 SmartObject Tester, K2 host server displayed the following issue when a K2 SmartObject is called:
K2 Automated Testing Software
BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.
"8250530","2014-08-31 16:41:36","Error","General","28083","ExtenderExecuteError","ProcessInstance.HandleException","28083 ServerEvent: Input string was not in a correct format.
InnerException: Input string was not in a correct format.Couldn't store <176.000000000> in Id Column. Expected type is Int64.
InnerException: Input string was not in a correct format.","","",
K2 backpearl Input String not in correct format errorUpon closer inspection, the SmartObject seems to be calling a SQL Server Stored Procedure and returning a scope_identity()
value
K2 SmartObject Method return Id propertyThis is mapped to a return Id
property.
K2 SmartObject Method return Id NumberIt looks like pre-468, K2 implicitly converts decimal scope_identity()
values to Int64, but not anymore with 4.6.8 – which is a good thing. The problem is just if you have legacy code, you will have to ensure the return values are Int, else the K2 will raise the "Input string was not in a correct format"
when the SmartObject is called. In our case, the K2 workflow went into error state
K2 backpearl Workspace – Input String not in correct format errorThe fix is simple. Ensure you declare an Int
variable in your Stored Procedure, and return the following
K2 SmartObject Method return Id property – intEnsure you refresh your K2 SQL Server Instance using the K2 SmartObject tester before attempting to re-run the K2 SmartObject or re-try the K2 transaction in K2 Workspace.
It all works now for us and our K2 customer is happy!