Hello, I need to save attachments that are loaded into the process on the hard drive of the computer.
Someone can help me?
Thank you
Greetings.
Hello, I need to save attachments that are loaded into the process on the hard drive of the computer.
Someone can help me?
Thank you
Greetings.
An easy way would be to add a script saving your file from the output operation of the file widget:
try
{
FileOutputStream fos = new FileOutputStream("c:\\temp\\storeThis.text");
fos.write(field_File1.getContent());
fos.close();
}
catch(FileNotFoundException ex)
{
System.out.println("FileNotFoundException : " + ex);
}
catch(IOException ioe)
{
System.out.println("IOException : " + ioe);
}
I’m attaching an example.
http://we.tl/wKIsY6isLm
I feel the same as a kkpatel. And when I run the process after having created the groovy connector with the code I do not save the attachment
Hi,
Which version of Bonita are you using?
Bonita BPM 6.3 comunity version
Hello i m using also 6.3 community . when i try to import process it give : Incompatible version error .
what should i do ?
i have same issue and i really need it thanks
Pl look following screenshot :
error as follow :
Please copy the Bonita Engine log to see the error must
Hello I am using Bonita Community Edition v. 6.3.
How can I retry a document saved on hard drive by the groovy script posted above by francois.chevresson?
Carry the code below:
try
{
FileOutputStream fos = new FileOutputStream(“c:\temp\storeThis.text”);
fos.write(field_File1.getContent());
fos.close();
}
catch(FileNotFoundException ex)
{
System.out.println("FileNotFoundException : " + ex);
}
catch(IOException ioe)
{
System.out.println("IOException : " + ioe);
}
I have configured a form in which I created an input field;
in the Data section I have setted these Data Decriptions:
Although this configuration, I don’t found - in Client Portal - link to retry original document saved on hard drive.
For completeness I show you the groovy script used to retry document link:
String path = “correct_path” +variable_storing_field_File1.getFileName();
return path;
@francois.chevresson Please, could you share this example again?
Thank you for all.
Best regards.
@francois.chevresson Please, could you share this example again?
I tried to download it but it doesn’t seems to be available yet…
Best regards.
hi , i really need this example , please if there anyone that have this example , plese share it!
Please, could you share this example again?
I tried to download it but it doesn’t seems to be available yet…
Here you go:
http://we.tl/hn3ZuGfIpc
Many thanks!
Hi François,
If I’m not wrong in this example file is saved in disk getting content directly from form field:
fos.write(field_File1.getContent());
But, what could I do if I want get contet from internal document associated with case? I have an acitivity at the end of the process that it should save in disk all documents attached during the process in previous tasks.
Could you help me about which api class I have to use to do that?
Thanks in advance,
Hi,
You can retrieve all the documents attached to the process instance using the processApi method:
http://documentation.bonitasoft.com/javadoc/api/6.0/sp/common/org/bonitasoft/engine/api/DocumentAPI.html#getLastVersionOfDocuments(long, int, int, org.bonitasoft.engine.bpm.document.DocumentCriterion)
From the document, you can get the storageId use to retrieve the content using getDocumentContent
Thanks,
I’ll try it, but do you know what values have to be set in fields “int pageIndex, int numberPerPage”?
API describes them as:
pageIndex - The index of the page
numberPerPage - The number of documents to list per page
but I’m not quite sure that it means.
Thanks for your help,
The file is saved correctly, but I need to continue appearing in other forms to download
in that case return the name of the document from the groovy script instead of a boolean and assign the result of the operation to a Document variable in bonita.