How to append two or more electronic files in the same mail using workflow with another image?
Thanks
How to append two or more electronic files in the same mail using workflow with another image?
Thanks
Since attaching multiple results from a Search Repository activity to an Email activity as file attachments is likely still of interest to people who may find this post, my colleague @████████figured out a clever way to do it.
Create a temporary folder (suggest naming w/ the WF instance ID for uniqueness), create shortcuts for each file, then attach the folder to the email. Don't forget to clean up the temp folder afterward. Adding error handling for Email activity failures (for example, if the combined attachments exceed max message size) with at least a Try-Catch is highly advisable.
Easy and simple ... thank you very much for posting this.
I've been trying to follow this in cloud but don't think it works? In cloud you must insert a 'download electronic document' activity before you can attach to an email however if i give it the temporary folder id then i get a workflow warning 'The source entry is not a document [0287-WF0]'. I can email a folder manually from the repository using the share function and it emails a zip file containing the folder contents, is there a way to replicate that in a workflow?
I've been trying to follow this in cloud but don't think it works? In cloud you must insert a 'download electronic document' activity before you can attach to an email however if i give it the temporary folder id then i get a workflow warning 'The source entry is not a document [0287-WF0]'. I can email a folder manually from the repository using the share function and it emails a zip file containing the folder contents, is there a way to replicate that in a workflow?
Does it still work but shows a warning? If so that can probably still do the trick since there could be zero attachments and still work. In other words if the warning is just a warning but it still works, does that accomplish what you need? On the one I setup I get a warning for any of the 10 branches that don't have an attachment. But it keeps on chugging along and does it's job.
Also, I am on prem, so not sure how things are different in the cloud regarding WF.
Laserfiche Cloud does not support these options. It will only send out files that are generated from Download Electronic Document. As the warning indicates, a folder does not have an electronic component, so there is nothing to download. Download Electronic Document will not iterate through the folder contents and export them.
Thanks for the confirmation Miruna. Am i correct to conclude that it's not possible to run a workflow in cloud and attach one or many attachments (variable number) from a folder and so a solution would need us to combine all the contents so there is one attachment? That might be possible with PDF to attach pages but not if the files are different MIME types (unless we PDF'ed them first). There is no built in WF activity to create a zip and append the files in workflow, is there?
@████████ thank you for posting the solution your co-worker created. It wasn't exactly what I needed but pointed me in the right direction.
One distinction here with Salah's solution is that it would work excellent with internal recipients with the correct permissions to the shared folder. For external recipients you would need to incorporate WebLink to share that folder out.
EDIT: I misread Sam's post and as to not add confusion, have removed enough of the original message to show that I was on the wrong path here :)
Chris, users do not need access to the repository to use Salah's solution. It is attaching the documents to the email itself, not a link.
Oh sheesh, that really is brilliant. This is where the magic is:
I had stopped reading at this and then went on assuming... trouble there :)
I'm going to edit my original post as not to cause confusion. Thanks for getting me on the right path Blake! And kudos to the LF team for the solution. It's plain 'ol slick.
Do you mean that you want Workflow to combine these files into a single document to email? Or are you asking how to add multiple attachments to a single email?
I have a document that comes from forms with two or more attachments electronic files.
A wf starts and i have to send a single email with all the attachments files.
Search for entries and used "by each entry" but with this at the end I have so many mails as documents found and
I want only one email with all the documents found.
Thanks Miruna
It is not currently possible to attach the results of a search to a single email.
Hi Miruna,
I've not got access at the moment to test but if a token is declared as an "Entry" type, would that work? Could that be added to an email as an attachment?
-Ben
Not quite. Only entries exposed by other activities can be attached. You can also attach files from disk. What you can't do is iterate through a set of files and append them to the same email.
The problem here is that we don't allow attaching a results set from Search Repository to a single email. That's by design because the number of results returned by a search can be arbitrarily large and most mail servers have restrictions on the sizes of attachments.
Is it possible to include a list of results in the body of a single e-mail, even if they can't be included as attachments?
You can create a multi-valued token, then inside of a "For Each Entry" loop which gets its entries from your search, append the current Entry Name to the token and then put that token in the body of your email.
Tried that, and it only seems to add the name of the first result as opposed to any others. What's more, it will only include more than one piece of information from the result (name, path, iteration of the "For Each Entry" process) in the token if I make sure to keep all of them on the same line. I've definitely allowed the token to have multiple values, and am definitely performing the token modification within a "For Each Entry" process tied to the search I'm running. What am I missing?
Can you try indexing the token in the email so it looks like %(Results#[]#)
-In the token editor or dialog click Apply Index and select all values separated by a ... then choose how you want them
That seems to be working now. Thanks!
Kevin,
I have a workflow set up that does a nightly search on several repositories and OCR's any documents that are not OCR'ed. I send a nightly e-mail report with the number of documents OCR'ed. I would also like to include a list of the Entry Names and Entry IDs of the documents OCR'ed. I have successfully created the workflow that retreives the entry information in a for each loop and appends the token variables. However, after I call over 10-12 appended token variables in the e-mail activity, the workflow will take a very long time to validate, publish, and run. If I call above 20 appended token variables, the workflow will not validate and publish at all. I need to call anywhere from 100-400 appended token values. Is there anyway I can configure this more efficiently or anything I can do to fix this issue? See the screenshots for more information.
Thank You,
Zach
Hey Zach,
I'm not able to reproduce this issue. Are there any errors in the Workflow Admin error log or Event Viewer?
Kevin,
I do not see any errors located in the Workflow Admin or Event Viewer that seem to be associated with this issue. The virtual server we have workflow service running on has 4GB RAM and 2 processors at 3.00GHz. The CPU will peak at 100% while attempting to validate/publish this workflow when calling over 10 appended token variables in the e-mail activity. The workflow will not publish and the CPU will stick at 100% until I cancel publishing of the workflow. You can see from the screen shots below the error log from Workflow Admin Console and how I have the e-mail configured. Any thoughts?
Zach, what version of Workflow are you using?
We are running Workflow 9.1.1.381 with the Laserfiche 9.1 Client Suite on our live server. I could try updating our test server first to 9.2 and see if the issues still persist. Thanks Miruna.
There were a couple of optimizations made to 9.2 for publishing workflows with lots of tokens.
I found a workaround for the problem of making multiple attachments when WF must iterate to find those attachments:
Since the email activity has to have an instance of an entry in order to make the attachment, I run a parallel with a condition nested inside of it. If there is a found entry with an index # it finds the document and therefore makes it attachable by the email activity.
So far, there is no lag in the multiple parallel activity. I have 10 branches. The lag comes when I the entries are converted to a PDF in the email activity. Total time has been under a minute even with 10 attachments.
I was following this thread trying to find a workaround. Hopefully this gives you an idea. There are more details to the solution. Let me know if you are interested and I am happy to share.
Cheers!
I am interested in a solution for this as well, but do not understand your reference to an index #. Do you mean the iteration of a duplicate named file? If so what if your looking for all the files that were independently uploaded to a form plus the form all uniquely named, but names are unknown to workflow? The only common piece of information to base the search is the BP Instance ID assigned to a metadata field. Any ideas?
If the instance ID is unique, then you can use a Search Repository activity to find all entries which have a certain value in that metadata field, just like a search in the Laserfiche Client. Then you can collect them names as shown above.
The reference to indexing is just a way to properly display the tokens. Putting a multi-value token in a text field will usually only display the first item, so index them to show all values. The syntax %(Multi Value#[,]#) means display all the values and separate them by a comma.
Kip, let me take apart your message and reply to it.
I am interested in a solution for this as well, but do not understand your reference to an index #. Do you mean the iteration of a duplicate named file?
No, it is the iteration of each attachment you need to make. The above activities exist within a 'For Each' activity where each entry is one that you need to attach to an email. I use the token calculator to 'add 1' before each entryid.
Token calculator:
Token including calculator digit:
The 'each entry' token is used later conditionally to process in the parallel 'index' branches:
The example above is on the Index 3 branch.
Lastly, I use the Find Entry activity to find the relevant entry without the preceding token calculator digit:
Once you use the Find Entry activity, you can attach it to an email. The only downside to this workaround is that for each attachment you need to make, you must have a parallel branch.
If so what if your looking for all the files that were independently uploaded to a form plus the form all uniquely named, but names are unknown to workflow?
If you can return the entries you want somehow, and get them into a For Each activity, then you can use my workaround. I don't have Forms, so I am just taking a stab at a solution here...
The only common piece of information to base the search is the BP Instance ID assigned to a metadata field. Any ideas?
Maybe query the LF table to determine the entryid?? Try using SQL or Crystal Reports to find the entries you need. Then use the SQL code you used to place in a Custom Query activity. Run a Find Entries on the returned entry ids. That is where I would start. Just some thoughts...
Hopefully, you have gotten an idea or two from this. I am happy to get more granular if it would be helpful.
Thanks Chris. I've just implented your solution, works great.
Hi Chris,
This is a great post. We have exactly the same need so we tried implementing the workflow which you have described. I have attached my workflow here with this post <email workflow.png>
1) I have defined 2 tokens required for each entry loop
2) Token calculator doesn't seems to increment
3) Find entry 2 - with ID: regular expression to locate the correct id seems to be not working
for 1,2,3 errors refer attachment <errors and issue.png>
Please help me with this issue...
thanks in advance
Rajah
Raja, I'll need to refresh my memory. I'll get back to you ASAP.
thanks a lot chris ... that will be very helpful
Hi Chris
Did you get any chance to look up !!!
OK Raja, I found some time. I see some things that need fixing in your pics.
Here are your questions:
1) I have defined 2 tokens required for each entry loop
Make sure they are empty in your "assign for calculation" activity. In other words, no data should be in the tokens that are there. "index Count" should be 0 and "each entry" should be empty. They get modified later and then data is added.
2) Token calculator doesn't seems to increment
Make sure your activity "assign calc entryid" modifies the "index count" token with data from the Token Calculator. Also make sure that the "index count" token is a 'modify' token.
3) Find entry 2 - with ID: regular expression to locate the correct id seems to be not working
Since the Token Calculator is not naming the entries correctly, the Find Entry (and Find Entry 2, etc.) won't find a match. You also must put the Find Entry activities within the conditional sequence. You don't want to run X number of Find Entry activities if you don't have to. If you nest the Find Entry with the conditional sequence, it only Finds the Entry if there is one there. Here is what my conditional sequence rules look like for Index 2:
Each of your issues are dependent on one another. Start with your first issue and then troubleshoot your way down your list.
Hope this helps,
Chris
Hi Chris,
Thanks a lot. This was really useful. Now my workflow works perfectly. Thanks again.
Regards
Rajah
So were you able to send multiple documents from the repository by one email?
You can attach as many as you have a branch for, so it is up to you. The thing to be careful about is exceeding the size an inbox will allow.
Hey Chris,
Any chance you can tell me a couple things regarding the above setup? Is the "Each Entry" a multi-value token? How are you getting each sequence to run successfully?
If it's not multivalue, it only runs the sequence for which is equal to (ie. 4 documents found, will run the 4th sequence). If it is multi-value (which I think it should be), when it does the find entry, it only works on the first one and then all of the others don't work. How do I tell it to look at the next value, with of course, not using the "for each value" function (If I do, I cannot use the email function). I do have it set to match a regular expression looking for the index number _2 (docID_2)
Thanks!