AnsweredAssumed Answered

What is the best practice to use attachment into my processes ?

Question asked by cdeneux on Aug 8, 2016
Hi all,

I'm looking for what is provided by Activiti to support attachments. Several proposals are mentioned in Activiti forum posts:
  1 Use a process variable containing the URL of the attached document,
  2 Use a custom form-type that allows to upload a file and store it in a process-variable as byte-array
  3 Use the API TaskService.createAttachment(…) to associate an attachment to a task instance and/or a process instance.

Each of these solutions have its limitations:
  1 we need to create a document space where attachments will be put and identified with an URL,
  2 as a variable, I think that a max size exists,
  3 to be used, the API required that a process instance exists, and no other API exists to be able to create a process instance initialized with attachment. So, a workaround is needed to have a process requiring attachments just after its start event. The workaround can be a user task just after the start event. The API TaskService.createAttachment(…) can be called on user task completion.

So, in a theoretical point of view, can you tell me what is the best practice to use attachment into my processes ?

IMO, the best choice may be the API TaskService.createAttachment(…) that should be completed improving the API RuntimeService.startProcessInstance…(…) to be able to set attachments when creating a process instance.

What do you think ?

Regards,
Christophe

Outcomes