I emphasized in my previous post the mechanism through which SmartObject data may be accessed within K2 Server Events. The specific example I gave was the case of a reporting feature for which I had been “awarded” responsibility (“Access Your Workflow SmartObjects Through Server Events”, 7/30/2016).

The feature was comprised of a K2 workflow process consisting of a server event that generates the report in HTML, an event that generates a PDF, and and event that persists the PDF in a document management system. As detailed in the previous post, the server event called SmartObjects to retrieve the data for the report, then used a StringBuilder object to create the HTML through a series of for loops before returning the completed HTML string to a process-level data field in the workflow process.

I began to wonder if perhaps the database engine could handle this transformation more efficiently, so I started digging into the stored procedures that support the report.

Continue reading