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

Question

Question

Forms and prohibiting protected file attachments

asked on July 19, 2022

IS there a way to prohibit protected file attachments?  The form suspends when it tries to save to repository after they return to sender.  What is weird is the form still saves to the repo just no attachment and leaves a suspended form in Monitor.  Just curious...  I am having my process/form owner remove the file before returning to sender, however it would be nice if they didn't have to. 

Trying to understand why it suspends even though it removes attachment and saves to repo.

Thanks :)

0 0

Answer

SELECTED ANSWER
replied on July 20, 2022 Show version history

Check your client settings (Tools > Options > New Documents > Settings) to see if you have "Generate Laserfiche pages" or "Generate searchable text" checked, or if you checked either of those in the initial import window.

Either of those options will require access to the document content, which means the password is required, but if neither are checked, it should just import the PDF without trying to open/access it.

The same would apply to the Save to Repository task if the connection profile used in Forms has either of those options enabled (generate searchable text might be enabled by default).

 

You can log into the client with the account used in the Save to Repository profile, and from there you can disable settings like that.

However, doing so would only prevent the save error and wouldn't resolve the overall issue, which is why I suggest the workflow approach.

That approach can detect inaccessible PDF files upfront so you could just reject the form outright and send a message back to the submitter letting them know one of their files was either password protected or corrupt.

1 0

Replies

replied on July 19, 2022 Show version history

Do you mean password-protected? The only time I've ever had a problem with password-protected files is when the profile is configured to generate pages, so I'll assume that's what is happening.

If that's the issue you're having and the attachments are all PDF, one thing you can try is to add a workflow that runs prior to the save to repository task.

In the workflow:

  1. Add a token to the workflow configured as a Boolean with the default value set
  2. Retrieve the file upload field using Retrieve Business Process variables
  3. Add a For Each File activity with that variable as the File Collection source
  4. In the loop, add a try-catch
  5. In the try catch, add a PDF Metadata activity to read some of the file properties
  6. In the Catch block, flip the value of the boolean token
  7. Pass that value back to the Form to indicate that a "protected" file was detected

 

This is the closest I've come, but it catches pretty much all of the files that can't be opened without a password, as well as some corrupt files, and has been pretty effective for us.

4 0
replied on July 19, 2022

What is the reason the task suspended? Have you checked the event log on the Forms server to see if there are more details on the error?

1 0
replied on July 20, 2022

Thanks for responding!  I did not see anything in event logs for the time that the form was trying to save attachment to the repository.  Jason, no it is a form that requires end user to upload medical documentation.  Some docs they get from their doctors are password protected.  I'm trying to reproduce the issue now so I can check event logs again.   I'll let you know what happens on my test.

0 0
replied on July 20, 2022

What Miruna means by event logs, is when a Forms instance gets suspended, then there will always be a log generated indicating the reason. When you click on the suspended instance (even if it has been resumed) there will be a clipboard icon that will open the log and show what went wrong.

And yes, password-protected PDF files are what I was referring to. The password-protection status of the PDF really shouldn't have any impact at all on whether or not the file saves successfully unless page generation has been enabled on the connection profile account.

To test that, I would suggest sending a test document through and checking in the repository to see if the stored PDF has an actual page count in the repository.

1 0
replied on July 20, 2022 Show version history

Ohhh that log.  Sorry lots of things going on.  I went to the server :)

Checking to see if I can put the same file into the repo also.

An error occurred during the execution of the Save to Repository service task. [LFF5426-ErrorExecuteSTR] Details: URL: Error: ErrorExecuteSTR Date: 7/20/2022 2:41:26 PM (Eastern Standard Time) HTTP Status Code: 500 Business Process ID: 126 Instance ID: 76172 Business Process Name: BeWell Incentive Forms Stack Trace: Caught exception: Laserfiche.Forms.CommonUtils.Exceptions.LFFormsException Message: An error occurred during the execution of the Save to Repository service task. [LFF5426-ErrorExecuteSTR] at Laserfiche.Forms.Routing.SaveToLaserficheService.Execute(Int32 instanceId, IRoutingContext routingContext, RoutingInstanceStatus OriginalStatus) at Laserfiche.Forms.Routing.ServiceTask.Execute(Int32 instanceId, IRoutingContext routingContext) Inner exception: System.Exception Message: Password needed at Laserfiche.PdfServices.PdfExtractor.LoadFile(Stream pdfStream) at Laserfiche.PdfServices.PdfExtractor.ImportPDFPagesFromStream(Stream pdfStream, DocumentInfo doc) at Laserfiche.PdfServices.PdfExtractor.ImportPDFStream(Stream pdfStream, DocumentInfo doc, DateTime dtLastModified) at Laserfiche.Forms.CommonUtils.LFHelper.TryImportAttachment(Session sess, cf_bp_attachment_data attachment, FolderInfo parentFolder, String volume, String attachmentName, String ext) at FormsModel.RoutingModels.Services.SaveFormToLaserficheStrategy.SaveAttachmentToLaserfiche(Session session, XmlDocument datasetXml, STLConfigurationObj conf, DocumentInfo rootddoc, String timeZone, String rootFolderPath) at FormsModel.RoutingModels.Services.SaveFormToLaserficheStrategy.SaveToLaserfiche(Session session, XmlDocument datasetXml, List`1 STLConfigList, SaveToLaserficheParameters saveToLaserficheParameters) at FormsModel.RoutingModels.Services.SaveToLaserficheHelper.OpenSessionAndSave(IEntityContext _AppContext, Int32 STLRepositoryId, List`1 STLConfigList, XmlDocument datasetXml, ISaveToLaserficheStrategy saveToLaserficheStrategy, String timeZone) at FormsModel.RoutingModels.Services.SaveToLaserficheHelper.SaveToLaserfiche(IEntityContext _AppContext, Int32 STLRepositoryId, List`1 STLConfigList, XmlDocument datasetXml, ISaveToLaserficheStrategy saveToLaserficheStrategy, String timeZone) at Laserfiche.Forms.Routing.SaveToLaserficheService.Execute(Int32 instanceId, IRoutingContext routingContext, RoutingInstanceStatus OriginalStatus)

0 0
replied on July 20, 2022

Required password when I drag into Repository too 

0 0
SELECTED ANSWER
replied on July 20, 2022 Show version history

Check your client settings (Tools > Options > New Documents > Settings) to see if you have "Generate Laserfiche pages" or "Generate searchable text" checked, or if you checked either of those in the initial import window.

Either of those options will require access to the document content, which means the password is required, but if neither are checked, it should just import the PDF without trying to open/access it.

The same would apply to the Save to Repository task if the connection profile used in Forms has either of those options enabled (generate searchable text might be enabled by default).

 

You can log into the client with the account used in the Save to Repository profile, and from there you can disable settings like that.

However, doing so would only prevent the save error and wouldn't resolve the overall issue, which is why I suggest the workflow approach.

That approach can detect inaccessible PDF files upfront so you could just reject the form outright and send a message back to the submitter letting them know one of their files was either password protected or corrupt.

1 0
replied on July 20, 2022

OK.  Both are selected.  I like your workflow solution and will build that out hopefully tomorrow.  The current solution I am having them use, is their is a person verifying the form and attachments before taking action on them.  I am having them remove the attachment before clicking return to sender which notifies them they have a protected file.

Thanks so much!!!  All this info has been extremely useful and helpful :)

Have a great evening!!

Sue

0 0
replied on July 20, 2022

You're very welcome.

A few things to note with the workflow approach:

  1. Make sure you add a hidden field on your starting form to hold the "valid/invalid" variable so it can be used in a gateway.
  2. Since Forms doesn't have a "boolean" type, the value will get passed back as text (i.e., "true" or "false")
  3. The gateway condition will need to match the value passed back to the form so make sure to test it a few times

 

Alternatively, instead of passing back a true/false, you could just have it be a normal string field that starts blank and only gets a value set when a bad PDF is detected.

That way you could have the gateway condition just check if it empty or not.

Either way, I would have one path check for a "valid" condition and have the "reject" path be the default since you should always have one default path without a condition and I prefer to have things "fail closed" in most cases.

1 0
replied on July 20, 2022 Show version history

Thanks for the extras :)  Like icing on the cake :)  I'll play with tomorrow.  Thanks again for your and Miruna's time :)  TTFN!

 

PS: And I have a full test environment so I will play in sandbox with this before implementing in productions :)

1 0
replied on July 21, 2022

Is this Forms 10? As of 11, there's an option in the Save to Repository task to ignore errors when generating pages from PDFs, so the task won't suspend anymore.

2 0
replied on July 21, 2022

10.  Good to know about 11.  Will get upgraded ASAP.   Almost have workflow working too so will implement that until 11 upgrade :)  Thanks bunches!!

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

Sign in to reply to this post.