Welcome to the Synergy Technical Blog and Technical Knowledge Base – a resource that shares intelligent and creative solutions that have been built and implemented on real-time projects on behalf of Velocity clients.
In a previous post we looked at how you can use Azure Blob storage as a file storage location and integrate that with your K2 application. In this post we will be looking at how you can let your application database live in the cloud.
K2 supports custom Service Brokers that allows K2 Developers to connect any data source with a K2 SmartObjects. During the development process, debugging is useful to troubleshoot your service broker’s code. In the blog post we show how you can debug a custom K2 service Broker by adding a break point in Visual Studio and attaching to the K2 HostServer process.
By using the K2 out-of-box worklist App or K2 SmartForm worklist control we generally can’t display K2 data fields and database column values in the K2 worklist, but we can develop a custom worklist to achieve this requirement. This is useful when wanting to display additional context when the user view the K2 worklist.
K2 SmartObjects and K2 Workflows are not limited to only being accessed via K2 SmartForms and Workflows. By using the K2 SmartObject & Workflow API’s you can access SmartObjects and their methods as well as create and start workflows through code.
To access K2 SmartObjects you need to connect to the SmartObject Client Server
Recently I had a request to change K2 Smartforms without changing the K2 theme. The K2 theme handles all the look and feel of the form, but the theme can’t be changed in runtime.
K2 injects the selected theme on form load and with a hosted Generic Handler it’s possible to change the styles of the K2 Form dynamically.
Create a Generic Handler in Visual studio with the Context of a .css file. The response content type of the generic handler should be “text/css”. This will return the text in the generic handler as a css file to be loaded in the page. If you don’t know how to create a generic handler you can watch this video https://www.youtube.com/watch?v=2Fz517kKtIE By Ankit Sethi. Below is a code snip of a css Generic handler:
This blog post illustrates how to generate a custom solution in K2 to generate a Pdf from a Word document in SharePoint, without making use of 3rd party components.
K2 provides the capability to generate a Pdf out-of-the-box – but is limited to a web page by supplying its URL as well as a smart form. In order to generate a Pdf on the fly for a Word document within SharePoint, WAS or Word Automation Services is utilized to help solve this requirement.
JQuery and other client side scripts can easily be integrated with K2 Smartforms through a K2 Smartforms control present in K2 control panel known as ‘HTML Literal’. Developer just need to drag and drop the HTML Literal control which comes out to be Runtime Literal. Developer can just put their code in Runtime Literal and play around with the controls and can execute control events. As JQuery is very much useful for instant feedback, hence the integration of K2 and JQuery makes the application more robust and user-friendly.
When configuring a K2 Client event, K2 allows you to configure a form that is displayed when the user clicks on a worklist item. Sometimes it’s required to add an additional parameter to the querystring K2 created. Often, this is an object identifier used to load a database record and this value is used as an identifier.
Configuring the client event to pass querysting information from the K2 designer to the K2 worklist form is as very simple. The following steps are used to achieve this: