K2 Limit on InfoPath form sizes?

  • 25 September 2005
  • 6 replies
  • 1 view

Badge +11
Hi,

We've had a client once trying to attach a 19MB file to an InfoPath form. The client ran into all sorts of problems. Below is the response I've sent:

[quote user=kb;EN-US;295626

This article states that the default value for the maxRequestLength parameter in the <httpRuntime> section of the Machine.config file is 4096 (4 megabytes). As a result, files that are larger than this value are not uploaded by default.

The machine.config file can be found in the 'c:WINDOWSMicrosoft.NETFrameworkv1.1.4322CONFIG' directory. Please note that changing the maxRequestLength parameter may allow you to upload larger files, but you will probably also need to change the executionTimeout parameter to allow the longer upload time.

PLEASE NOTE:
K2.net 2003 is a workflow engine and as such was never intended to be and never will be a document management system.

It is STRONGLY (and I can not stress this enough) recommended NOT to upload files to K2.net larger than the 4MB default set by Microsoft. If you exceed these defaults, you will most probably cause timeouts in SQL Server, IIS, Web Services and InfoPath and will definitely occupy most of your machine resources. The whole performance of K2.net 2003 will also be negatively affected.

As an example:
If you start a simple 2 step InfoPath process with a 19MB file attachment which is then destined to be approved or discussed by 5 users, you will send 19MB through the InfoPath web service to create and start the K2 process and K2 will create 5 copies of this file (95MB) to be stored in both the K2 and K2Log databases. With more Activities and more Destination users in your K2 process, you will dramatically increase this amount not to even mention the impact of enabling XML field auditing.

Apart from CPU and memory resources, your K2 and K2Log databases as well as the Transaction Log files will grow uncontrollably and you may very quickly run out of hard disk space.

Recommended solution:
A recommended solution would be to save the file to the file system on a network share and only store the path to the relevant file in K2.

Hope this helps,
Ockert

6 replies

Badge +5
We currently have an InfoPath integrated K2 proces with a form to which the users can add an unlimited number of potentiall beefy scanned documents. Since InfoPath stores these in the xml that would travel around the process, we are wondering if anybody had come across any limitations on the InfoPath form size in K2.

Also if anyone has encountered a similar scenario, it would be great to hear some best practices on the matter.

Thanks in advance
Badge +5
Thanks for the info and the recommended solution! It's something similar to what we expected...
Badge +7
Hi all,

I will face exactely the same problem in my process. Currently I have a workaround. I have a browse button in my InfoPaht document with which you can select the required files. The filepath then gets entered into a textbox and when submiting the form the K2 workflow will be started and a seperate email will be sent (including) the attachments to the receiver.

Still have a question what actually happens with a View which won't be used in the workflow. Lets assume that I have a button on the document which triggers a switch view event. In this view you do nothing but including all required attachments, also the view has his own submit button. By clicking that you send the document (including the attachments) as an eMail attachment (via the submit functions of Infopath) and you also switch back again to the original request view. After that you complete (if it wasn't completed yet) filling out the form and submit it to start the workflow. The mentioned view with the attachments won't be used in the workflow (e.g. there is no activity for).
Will I still have the problems with the attachments.
I am actually quite sure. YES.
Someone some ideas ?

Thx
Badge +6
Having a seperate view in your InfoPath form will not influence K2.net at all. The client events will always open in the view specified when setting up the client event in K2.net Studio. Also if a user clicks on the button on the 'email' view the codebehind in InfoPath will be used to send the email - K2.net. When the user clicks on the 'Submit' in the K2.net Task Pane the workflow will be started.

As far as I understand the problem with the attachments is the size of the attachments. If you can have links to the attachments in the workflow there will not be any problems - Just keep the large attachments on the file system.
Badge +4
So if there are large files(>4MB) to attach, we will upload them to a file system and save the link to the file instead.

Is there a control in InfoPath form that can perform this? Or Is there a file browser control in InfoPath to pick the file name to be uploaded?


Thanks
LW

icon-quote.gifnukkumatti:
Hi all,

I will face exactely the same problem in my process. Currently I have a workaround. I have a browse button in my InfoPaht document with which you can select the required files. The filepath then gets entered into a textbox and when submiting the form the K2 workflow will be started and a seperate email will be sent (including) the attachments to the receiver.

Still have a question what actually happens with a View which won't be used in the workflow. Lets assume that I have a button on the document which triggers a switch view event. In this view you do nothing but including all required attachments, also the view has his own submit button. By clicking that you send the document (including the attachments) as an eMail attachment (via the submit functions of Infopath) and you also switch back again to the original request view. After that you complete (if it wasn't completed yet) filling out the form and submit it to start the workflow. The mentioned view with the attachments won't be used in the workflow (e.g. there is no activity for).
Will I still have the problems with the attachments.
I am actually quite sure. YES.
Someone some ideas ?

Thx
Badge +7
Hi coenw,

in the meantime I have changed our set up a bit.
I do the following:
In the request document I have a button called create folder. When the users press this button it creates a new folder with a unique ID. To generate this unique ID I use the following Web Service (thx to abishek from the InfoPath forum):


{"ID_" + DateTime.Today.Year + "_" + strNum.PadLeft(6,'0')});
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
}
}


That you can use this WebService you also need to create a text file with the initial value "0". Also don't forget to specify the path of your text file in the WebConfig of the WebService

Then in your InfoPath project you need to do the following two things. (I am using the InfoPath Toolkit for VS, so all my code is in C#). I use the "counter node" to make sure that the WebService is only called once and does not create a second or third or ... ID for one request. The ID node is used to store and represent the ID to the user. Take care for the namespace settings (will be different for you I guess)


public void OnLoad(DocReturnEvent e)
{
IXMLDOMNode counter = thisXDocument.DOM.selectSingleNode("my:myFields/my:tbCounter");
IXMLDOMNode ID = thisXDocument.DOM.selectSingleNode("my:myFields/my:tbID");
try
{
if(counter.text == "0")
{
IXMLDOMDocument3 myDoc = (IXMLDOMDocument3)thisXDocument.GetDOM("NextIDNumber");
myDoc.setProperty("SelectionNamespaces", "xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-06-19T07-15-47" xmlns:xsf="http://schemas.microsoft.com/office/infopath/2003/solutionDefinition" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xdUtil="http://schemas.microsoft.com/office/infopath/2003/xslt/Util" xmlns:xdXDocument="http://schemas.microsoft.com/office/infopath/2003/xslt/xDocument" xmlns:xdMath="http://schemas.microsoft.com/office/infopath/2003/xslt/Math" xmlns:xdDate="http://schemas.microsoft.com/office/infopath/2003/xslt/Date" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:dfs="http://schemas.microsoft.com/office/infopath/2003/dataFormSolution" xmlns:tns="http://tempuri.org/" xmlns:_xdns0="http://schemas.microsoft.com/office/infopath/2003/changeTracking" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"");
ID.text = myDoc.selectSingleNode("/dfs:myFields/dfs:dataFields/tns:NextIDNumberResponse/tns:NextIDNumberResult/NewDataSet/Table1/ID_Number").text;
counter.text = "1";
}
else
ID.text = ID.text;
}
catch (Exception ex)
{
thisXDocument.UI.Alert(ex.Message);
}
}



Now first add a button and a new textbox control (name it link) to your form. In the button event handler do something like the following:




public void Create_Folder_OnClick(DocActionEvent e)
{
IXMLDOMNode ID = thisXDocument.DOM.selectSingleNode("my:myFields/my:tbID");

string strDirectory = @"""your path where you want to create your folder"";
System.IO.DirectoryInfo dir = System.IO.Directory.CreateDirectory(strDirectory + ID.text);
IXMLDOMNode link = thisXDocument.DOM.selectSingleNode("my:myFields/my:Preform/my:Preform_Available/my:tbLink");
link.text = strDirectory + ID.text;
}


Like this you create a new folder under the specified path and also write the full path into your "link" textbox control. Use this textbox control as a datasource for a Hyperlink in your form.

The usage is now: The user clicks the button -> A new folder under your specified path will be created -> in the form a Hyperlink appears which point to this path -> The user clicks the Hyperlink and the newly created folder opens. Of course the folder is empty but the user can just drag and drop his files into the folder. Before I also used a browse button but the users where complaining about that quite fast because the drag and drop handling is a lot faster for them.

You should copy the Hyperlink of your form into every view so that each user of the process has access to the attached files. Take care that you grant every user read and write permission to the top folder in which you create the new folders for each request.

The nice thing about this solution is also that in the reporting section of the K2 Workspace under the XML data of each request the link is also activce and you can review all attachments for all requests any time.

Hope this can help you. If you want to have a browse button use the OpenFileDialog method. You can find examples on the net or even in VS when searching for it.

Reply