You are viewing limited content. For full access, please sign in.

Question

Question

LF Workflow "Retrieve Business Process Variables" can't get "File Upload" name list

asked on October 16

I am working on a workflow that need get a Form's uploaded file list.

The "Retrieve Business Process Variables" can locate the "File Upload" variable but its contents isn't something display on Forms instead are those stored inside Laserfiche Form database.

I am wondering if anyone dealt with such situation and get the original uploaded file names out of the control/variable?

File names on the form

 

file name (list) got from workflow activity

 

 

0 0

Answer

SELECTED ANSWER
replied on October 19

Since file upload fields allow multiple files, Workflow does not generate a single token for the name, but rather a data set (like Query Data or Search Repository). You can use For Each File to go through the uploaded files and get their name, size or extension.

1 0
replied on October 19

Thanks Miruna, that's far better than anything Luke or I had figured out.

0 0
replied on October 19

Aha, didn't notice there are multiple "For each" other than always use "For each value" when deal with normal dataset.

Thanks Miruna that solve the issue.

0 0
replied on October 20 Show version history

Update: the "for each file" activity works fine with "File Upload" object get from Form submission. However it works when all file (contents) are in the place they save to (DB table or external OS folder). If any one of the files being removed then "retrieve" step will throw exception and stop the whole workflow unless you put it inside "try-catch" block. 

You ask how come a file being removed? well, if it's a virus file that being scan/removed by AV engine.

 

@████████

is it possible to not to stop on file content missing but return the file name list anyway ?  What we build the workflow for to report such missing cases so the next user can see the information and don't continue. 

 

Other thoughts:  now after form submission, anytime after that open the form will display uploaded files. Unless you need open file for viewing/save files to repository it will report file missing.  If Form's process has build-in mechanism that check file availability at load time (web page) and display missing message, then there is no need for us to build something doing the scan/match/report. 

0 0
replied one day ago

There is no way to turn off that error at this time.

0 0

Replies

replied on October 18

As you have no doubt noticed, you can get a name for the uploaded file in the workflow, but it is not the name the file had when it was uploaded. I don't know any simple way to get it, but there is a workaround.

First, the user submits the form with the uploaded file, you can use the "Save to Repository Service Task" in Laserfiche Forms to save this file into the repository. In this operation, you will have access to the original file name, which you can put on a metadata field of the file you save. Make sure you also save the file with whatever metadata you need to associate it with the form submission.

Then, in your workflow, you will be able to retrieve the file, work with it, and retrieve the original file name from the designated metadata field.

Best wishes!

0 0
replied on October 19

Thanks for the tip. Unfortunately the workflow need run before save those uploads to repository.  After some digging into Form's database directly, I can tell the numbered filename got from this control are the "attachment id" in one of the Database table.

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.