Problem With Attachments

  • 17 August 2015
  • 2 replies
  • 1 view

Badge +1

I am designing a workflow, which will require an excel form to be submitted by the initiator. Depending on the selections made in the second step, this excel form needs to be modified. Because of requirements from the business owner I can’t get rid of the excel form and replace it with data entry on actual K2 form.

 

My questions are:

Is it possible to write a script to take an attachment record stored in database and save it to a temporary location on a hard drive? After this step, I will modify excel form. After the file was modified, is it possible to write a script to save this file back to the database replacing the old record?

 

Alternatively, is it possible to save K2 attachment permanently on a hard drive instead of database table?

 

Thank you


2 replies

Badge +9

Albert


 


Unfortunately, there is no way to save a save a document from a K2 to a local location OOTB. However, when documents are loaded on a computer, they are save in the local directory at dir/K2 Smartforms RuntimeFiles. You could feasibly write a script that would then save that file to another location for permanent storage. And there is shold be nothing wrong with updating the database with the new file  when it is updated, though this will also have to be custom script.


 


Ian

Badge +1

Ian,

 

Thank you for your response. I have no problem with following your advice, but I have some unsolved issues there.

 

In my case temporary folder for storing loaded files is not in K2 Smartforms RuntimeFiles. I believe K2 stores files, which are being viewed by users in this location. Files, which are being selected for upload are temporary stored in C:ProgramDataIsolatedStorageoze4wqbn.i3o followed by another folder. This folder is stored in database as follows <field name='FilePath'><value>kflqx01o.lw3ACTUAL FILE NAME.xlsx</value></field>. I can create a script, which will take this file, while it is still in temporary folder and save it to the permanent location. But I don’t know how to modify the FilePath field in database record, so K2 can load this file from the permanent location.

Reply