Passing parameters in URL using K2 workflow
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:
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.
When you configure the Client Event action the first part of the wizard will ask you 2 things:
- The Task URL
- The Additional URL
The Task Item URL opens when the user clicks on the worklist item. It’s important to configure this correctly to ensure the correct form open when the user clicks on a worklist item in order to action it.
Now, in this case we want to change the Task Item URL to add the serial number of the worklist item to the URL where it is later used to loan the correct worklist item.
Here is an example of the setup screen of the Client Event Wizard:
How to use a parameter added to the Task Item URL?
The K2 SmartForm below gets the details from the URL defined in the Task Item URL and then passes it to the SN and IdeaId form parameters when the SmartForm initializes. It’s up to you to use the parameter in the SmartForm to open the workflist item for example (SN is used in this case), or get the information from the database using a SmartObject Load() method passing in the IdeaId
When loading a worklist item in K2, it is required to pass the serial number (SN) parameter to the SmartForm. In addition, additional querysting parameters can also be passed in. This is configured in the Task Item URL in the K2 Client Event Wizard and copied into the K2 SmartForm when the form initializes.