ASP.NET apps with K2 Five process

  • 29 November 2018
  • 7 replies
  • 225 views

Badge +6

We have several ASP.NET apps built with extensive 3rd party components like Telerik. They interact with K2 4.7 using K2 for Visual Studio and pass form data using XML data fields.

 

I can see that K2 Five introduces a completely new paradigm and extends the Smartform front-end component with the new browser-based process designer as described here.

 

Re-building our ASP.NET apps in SmartForms is not feasible, Smartforms just doesn't have all the capabilities.

 

So given that K2 4.7 and legacy tooling like K2 for Visual Studio will be retired after 12/31/2019, how can our ASP.NET apps integrate with the new K2 Five process designer? In other words, how would the form data be passed to the process designer for use in line rules, tasks, actions, outcomes, etc.

 

Any ideas appreciated. Thanks


7 replies

Badge +10

Hi VA1


 


If I understand your question correctly, you have custom ASP.NET pages that interact with a Workflow created in K2 for Visual Studio.


 


The legacy Workflow will continue to work if you upgrade to K2 Five, but as you said, there will come a time when legacy support will be removed.


 


With K2 Five you still have the ability to interact with SmartObjects via the SmartObject OData service and Interact with Workflows (Legacy and HTML5) via the Workflow REST service.


 


See the following documentation for more info: https://help.k2.com/onlinehelp/k2five/userguide/5.2/default.htm#K2-Management-Site/Integration/APIs.htm


 


Cheers,


ThinusC

Badge +6
Right, I understand that I can interact with K2 using the REST endpoints but how can I pass how the form data like the value of controls like text boxes, drop-down lists, radio buttons, Telerik grids, etc. be passed to K2 via these REST APIs so the process designer can use these values in line rules, tasks, actions, outcomes, etc?

Thanks
Badge +10

Hi VA1


 


So you want to interact between your custom ASP pages and Smartforms?


 


If you have data you need to pass into a SmartForm, you can make use of Form parameters


 


Then when accessing the Smartform you can pass parameters in the URL.


 


e.g. https://[K2URL]/Runtime/Runtime/Form/TestForm/?Parameter1=1&Parameter2=test&Parameter3=True


 


To start/action workflow you should be able to use the Workflow REST API


 


Cheers,


ThinusC

Badge +6
No, we are not using Smartforms just .NET interfaces. How can I pass formdata from the screen to K2 for use in process designer line rules and actions?
Badge +10

Hi VA1


 


In that case you will need to make use of the Workflow REST API.


 


In you workflow you can add Process Data Fields. These Data Fields can then be used in line rules, action, etc.


 


When calling the Workflow REST API, within the JSON data you can specify the Workflow Data Fields.


 


Example:


In the workflow you have a Data Field called UseLineRule (type number)


In your workflow  you have two lines,  Line1 with a If UseLineRule = 1 Line Rule, Line2 with a If UseLineRule = 2 Line Rule


When calling the Workflow REST API, you pass a UseLineRule = 2 within the JSON.


{
"folio": "REST Test",
"expectedDuration": 86400,
"priority": 1,
"dataFields": {
"UseLineRule": 2
}
}

 


This will set the Parameter in the Workflow to 2 and cause Line2 to be followed. 


 


Hope that helps.


 


Cheers,


ThinusC

Hi,

Can someone give a sample code block or any blog which shows how to connect asp.net forms with K2 five workflows.

Any information would be really helpful.

 

thanks.

Badge +1

For ASP.NET connect to K2 Five workflow, you have 2 options

1. Reference dll like you do in K2 blackpearl. K2 Five and K2 blackpearl use the same class and method. You just need to rebuild to make sure it'll work.

2. Using REST API. Sample in this link https://help.k2.com/onlinehelp/k2five/DevRef/5.3/default.htm#Runtime/WF-REST-API/Workflow-REST-API-Samples.htm%3FTocPath%3DRuntime%2520APIs%2520and%2520Services%7CWorkflow%7CWorkflow%2520REST%2520API%7CWorkflow%2520REST%2520API%2520Samples%7C_____0

Reply