Help with K2 , ASP.Net and SQL server

  • 29 January 2006
  • 3 replies
  • 1 view

Badge +1
Hi:

I am new to K2 so I need some clarification about its integeration with ASP.Net and SQL Server.

I have a simple process which has 3 web pages in total and it is working fine. Now I want to know whether there is a way to flood the controls on load with values from a database table(i.e Customer Name, Address, Phone etc from Customer table which is stored in Companies DB and not K2 Database)?.

One more thing... can we have any ASP.Net Web control on a form ..or is it necessary to have K2 web controls only on a form?.

Thanks.

3 replies

Badge +8
can we have any ASP.Net Web control on a form
Yes, since K2.net Smartforms are inherited from ASP.NET forms. If you are using a SmartForm, you may want to put the data captured by your asp.net control into process data - to do this, you can add a hidden K2.net Control (e.g. a textbox), bind it to one of the process datafields, and at runtime populate this hidden K2.net field with the value captured by your ASP.NET control.

Hope this helps...
Neil
Badge +1
Hi NeilM,

Thanks for ur reply. It was really helpful since there isn't too much stuff about K2 and ASP.Net on the Web. Even K2 website doesn't offer that many useful articles about working with K2 and ASP.net + SQL Server database.

Does Microsoft Application Blcok (MAB) work fine with K2?. Do we have the Database connection setup in K2 SmartForms the same way we have in normal ASP.net application .i.e can we have a connection string in Web.config file and then use MAB to work with database?.

Ok.. I am a bit confused here... e.g I have to create a process for Time Off Request for the Company's Employees. I know when the Employees fill out the Time Off Request form. K2 saves the information in its database in its own tables. ..... Now here I am confused whether we need to save this data in our companies database too....that means I will be saving the same data in 2 Databases..which is redundant...Does that mean that I save the data on K2 Database only...However if an employee wants to see how many time off requests it has made, when did it make, status etc... I need to get it from K2 Database then... but the k2 database is so complicated ...it is hard to find related tables....

I hope this post makes some sense...
In cas eu want some clarification do let me know....

Thanks,
S.
Badge +8
Does Microsoft Application Blcok (MAB) work fine with K2?. Do we have the Database connection setup in K2 SmartForms the same way we have in normal ASP.net application .i.e can we have a connection string in Web.config file and then use MAB to work with database?.

Yes, you can use the ApplicationBlock in a SmartForm as you would use it in a normal ASP.NET form.

Note however that it is not recommended and not supported to access the K2 .net Databases directly - if you need to retrieve information from the K2.net databases use the provided API's and Web Services.

K2 saves the information in its database in its own tables. ..... Now here I am confused whether we need to save this data in our companies database too....that means I will be saving the same data in 2 Databases..which is redundant
One way to approach this would be to store the information you want to report on externally in another DB, and in your K2 process instance data only store a pointer to this external data (e.g. unique ID) . When the form loads, you can then use this pointer value from the K2.net process instance data and populate fields on the form with the values you stored externally - this way you only store the information once.

Generally, we recommend that data values that are used in the process execution (for example in line rules, destination rules, succeeding rules etc.), be stored in process instance data, but if you want to you can also store that data externally and modify the code in the rule to lookup the information from another data source. Also, if you have enabled the 'keep audit trail' option on datafields K2.net will automatically keep an audit trail of the fields for you , whereas if you only store the fields externally, you will have to implement some other method of audit trail.

but the k2 database is so complicated ...it is hard to find related tables....
Have a look at the following KB article which discusses custom reporting in K2.net:
http://kb.k2workflow.com/Articles/KB000021.aspx

There are many ways to approach the design of your solution and business requirements can impact on the design. I would suggest that you contact your local K2.net Office to see if one of the consultants can assist you during the design process.

Regards,
Neil

Reply