Remove document

1
0
-1

Hi,

In a process, users can submit a request with attachments.
Then, they can edit the request and add/remove attachments.

When the process is finished (i.e. archived), we see all attachments included those removed there.
How can I definitively remove attachments ?

Regards.

Erwan

1 answer

1
0
-1

Hi Erwan,

You should use the processApi method deleteContentOfArchivedDocument(Long archivedDocumentId);

here is a small piece of code that can help you for that :

ProcessAPI processApi = apiAccessor.getProcessAPI();
SearchOptionsBuilder builder = new SearchOptionsBuilder(0,100);
builder.filter(ArchivedDocumentsSearchDescriptor.PROCESSINSTANCE_ID, processInstanceId).and().
filter(ArchivedDocumentsSearchDescriptor.DOCUMENT_NAME, "your_document_name");

SearchResult<ArchivedDocument> results = apiAccessor.getProcessAPI().searchArchivedDocuments(builder.done());

for (ArchivedDocument doc : results.getResult()){
    processApi.deleteContentOfArchivedDocument(doc.id);
}

This will delete all archived versions of your document "your_document_name" in your case processInstanceId. Keep note that only document content is removed, not document mapping (metadata).

Cheers,

Mehdi Kettani

Notifications