How to modify document list content

Hi,
Can you help me? (I’m using Bonita Community 7.2)

I’ve a process involving various steps:
RANF Process

From Instantiation form I acquire Model Contract and a variable list of files as attached documents via upload widget:
Upload widget
Please note that some file are mandatory and some optional!

My Process Instantiation Inputs are:
Process Instantiation Inputs
Please note: “allegatiRANFInputs” type FILE is “MULTIPLE”!!!

Where my Pool variables are:
Pool variables

And my Documents are:
Documents
Defined as follow:
Allegati Ranf definition
Please note “Initial content->From contract”.

This is my “formOutput.allegatiRANFInput” with 3 attachment (2 mandatory and 1 optional) before submit in JSON format:
formOutput.allegatiRANFInput

This is H2 bonita_journal.db content after submit:
H2 DOCUMENT
H2 DOCUMENT MAPPING

Now, in a subsequent human task: “Modifica la richiesta rifiutata”, I need to present to user the list of previously attached files (done via a check list) and the user must have the choice to change some of them. The “Task Inputs” are:

  • richiestaANFInput:COMPLEX
  • allegatiRANFInput:FILE:MULTIPLE

I have:
allegatiRANF_ref

That I show to user as follow:
Mod. Upload

If user uncheck the checkbox from existing attachment then it can be upload as new file:
Mod. Upload bis

Then user will upload only the removed mandatory document and in formOutput.allegatiRANFInput’ I have:
allegatiRANFInput MOD

Now if in the operation pane of human task if I use the default operation “Set document list”:
Set Document List

It works but I lost the 2 existing documents (that user do not want do modify and that do not upload again) and list was updated and contain only with the new uploaded document.

So I removed the previous op. “Set documetn list” and I defined a fake string variable “aggiornaATTACH” that take values “”:
aggiornaATTACH

from the following script:
aggiornaATTACH Script
But does not work!

Which is the correct way to “update document list” in bonita without removing existing ones?

Thanks

I found the solution to my problem!
In the “Operations” of “Execution” of “Modifica la richiesta rifiutata” human task i use the “Set document list” as follow:
SETDOCUMENTLIST

The associated groovy script is this:
GROOVY SOLUTION

P.S.: Please note that old files are still in the Bonita Journal:
BONITA JOURNAL
Bye