Hi,
i would like to get a name of document that has bee attached .
regards
Hi,
i would like to get a name of document that has bee attached .
regards
First you must retrive document content by using Bonita API
import org.bonitasoft.engine.bpm.document.Document
Document doc = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, “attachment”)
doc.getContentFileName()
check ProcessAPI for more Document methods
Here you go:
Document d1 = apiAccessor.getProcessAPI().getDocument(docID);
String documentname = d1.getContentFileName();
regards
Seán
PS: If this reply answers your question, please mark as resolved.
Where i have to put this code? in a conector, in a variable?
Also i have to say that, the document will be attached using attached widged .
regards
you can put it in a groovy output connector, after user attached the file
sorry i’m newble, so in the code, how i can to reference to my attached docuement. I have to change the “attachment” word , and then put the name of my variable (variable name: attachedDoc)
please , any help!!
instead of attachment, put your documents varaible name
Document doc = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, “attachment”)
i have put it but it doesn’t works, here is the code:
import org.bonitasoft.engine.bpm.document.Document
Document doc = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, '${doc}')
doc.getContentFileName()
wich is the type of variable, in this case ‘doc’ variable?
Its the name of the document added to your process, and its a String
instead of ${doc}, just put the name of the document, if your document’s name is doc, just put
Document doc = apiAccessor.getProcessAPI().getLastDocument(processInstanceId, ‘doc’)
I’m a beginner, can you tell me how i can implement this code step by step.
regards