K2 SmartObjects

Passing parameters in URL using K2 workflow

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:

When you configure the Client Event action the first part of the wizard will ask you 2 things:

  1. The Task URL
  2. 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:

Passing parameters in URL using K2 workflow

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

Passing parameters in URL using K2 workflow

 

In summary

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.

Passing parameters in URL using K2 workflow

You may also like

Leave a comment

PODCAST  |  Why you need to establish a K2 Center of Excellence today

Interview with Arno van Rooyen, CEO, Velocity