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

Question

Question

attaching multiple files to email in workflow

asked on June 16, 2017

Created a workflow for attaching multiple documents to an email in workflow.  The WF runs, and sends the email, however, it does not attach the expected files to the email.  What is incorrect in the workflow?  

testforPASC.png
testforPASC.png (45.76 KB)
0 0

Replies

replied on June 16, 2017 Show version history

Have you checked the results of the workflow? From the look of the Find Entry activities it seems like they are not getting valid Entry ID's and therefore won't find the document.

You're using %(Entry Name) and %(Date) tokens where you should be putting an Entry ID value. The %(Entry Name) is referencing the string name of the Starting Entry, which is very unlikely to be the ID value you are trying to get, and the Date definitely won't be a valid entry ID value.

I'm a bit confused by some of the activity configuration you have in there, so I'm not sure exactly what is supposed to be happening in the workflow. I don't see any way for your workflow to attach more than one document to the outgoing email.

For example, despite the parallel branches, there's no way the "first result name" could end with both 1 and 2, so there's no condition in which you would have more than one document to attach even if you get the correct Entry ID in each of the Find Entry activities.

0 0
replied on June 16, 2017

Ah, sorry... I see your confusion.  I started playing with different values for the Find Entry to see what I might be configuring incorrectly.  Sorry for the confusion... 

0 0
replied on June 16, 2017

It looks like you are using the solution from this post. If so, then you should be using a multi-value token to store each of the entry IDs. The following process should work and be less dependent on regular expressions.

  • Create multi-value token for "Entries"
  • For each entry
    • Route Entry
    • Append %(ForEachEntry_CurrentEntry_ID) to "Entries" token
  • Create/Assign "EntryCount" token with %(Entries#@Count@#), use Count or Integer tag
  • Parallel Branches
    • Branch 1
      • IF "EntryCount" token > 0
      • Find Entry by ID - %(Entries#[1]#)
    • Branch 2
      • IF "EntryCount" token > 1
      • Find Entry by ID - %(Entries#[2]#)
    • Branch 3
      • IF "EntryCount" token > 2
      • Find Entry by ID - %(Entries#[3]#)
    • etc.
1 0
replied on June 16, 2017

I will try this and update you with my results.  Thx :-)

0 0
replied on June 16, 2017

You should also probably remove the Parallel/Conditional Sequence combination and replace it with a "Conditional Parallel"

That will give the both functions in a single activity.

1 0
replied on June 16, 2017

Am I on the right track or have I gone off the rails...?

UPDATEtestforPASC.png
0 0
replied on June 16, 2017 Show version history

It looks like you're getting closer, but you need to make a couple of changes. First, you should be creating the multi-value token before the "for each entry" loop, then you append another value each time the loop completes.

Remember the for each entry is a loop, so you add the "current entry: entry id" with each iteration, you can't add them all at once like that. Also, unless I'm misunderstanding your goals, the Conditional Parallel needs to be outside of the for each entry loop, more like in the following image:

EDIT: Branch 3 should have %(Token 1#[3]#)

I'm still a bit confused why you are evaluating the name of the "For Each Entry: Current Entry" in your conditions.

0 0
replied on July 12, 2017 Show version history

okay so I'm back to testing this workflow.  I made mods based on the graphic you included.  However, I'm still not able to get attachments.  

 

I have included the wf as it stands now, below.  Your thoughts would be appreciated.  

test20170608-b.png
0 0
replied on July 12, 2017 Show version history

I'm still seeing the same issues with your conditional parallel and the Find Entry activities contained within the branches. The conditions are still looking at the Name of the first search result, so it would never hit more than one and isn't looking for the correct condition.

You will need to update the conditions to match the ones I had in the example; it should be looking at the count token (Token 2 in your screenshot) to determine how many files are available to attach.

If the count is 2, you would hit branches 1 and 2, if the count is 3, you hit branches 1, 2, and 3, and so on.

 

Additionally, after that is fixed, your Find Entry activities are set to find entries based on static values, not tokens. For example, the first branch looks for an entry with the ID of 1, so even if it hit that branch it would always return the same entry.

To correct that, you should be using "Token 1" where you are storing the Entry IDs, and using token formatting to set the Index of which item to retrieve. Index 1 for branch 1, Index 2 for branch 2, etc.

 

You should also be checking the Condition results and Token values after the workflow runs to make sure everything is being evaluated and tracked correctly. Those tabs will go a long way to helping troubleshoot and figure out exactly what part of the workflow is causing issues.

0 0
replied on July 12, 2017

I should have asked this before, however, which version of wf are you using?

select_Entry.png
select_Entry.png (19.66 KB)
0 0
replied on July 12, 2017 Show version history

I'm currently using 10.2, but I've used this same workflow configuration at least as far back as 10.0, and the activities we're using here should still work the same even in a 9.X version.

Again, I'm trying to understand why you are setting up the condition that way.

With the setup shown here, it is looking to see if the Name of the First Result ends with a 1, and I don't understand the motivation behind that setup.

The only way that would evaluate to True is if the first result of your search was Named, "name1" or something along those lines.

0 0
replied on July 12, 2017

I only asked because I don't have the append to token value check box when I create a token under 9.2

0 0
replied on July 12, 2017 Show version history

Can you attach a screen shot of the activity that creates the token? You need to mark it as a "multi-value" token to enable that functionality and 9.2 should have the same capability.

0 0
replied on July 12, 2017

attached token ativity

token.png
token.png (120.28 KB)
0 0
replied on July 12, 2017

Your "Update Token Values" activity is not "updating" Token 1, it is "creating" a new token named "Token Next"

You have to Modify the existing multi-value token to have the Append option. Currently it is just creating a new token each time it goes through the loop.

0 0
replied on July 12, 2017 Show version history

attached is a brand new token creation... I don't see where I have the append option...

token.png
token.png (27.75 KB)
0 0
replied on July 12, 2017

That is the problem, you're selecting "Create" token, but you need to select Modify to be able to append values to the existing token you already created at the start of the workflow.

Create makes an entirely new token

Modify updates/adds values for an existing token

0 0
replied on July 12, 2017

I'm sorry i'm missing it... I just don't see where I can add or activate these options...

token3.png
token2.png
token1.png
token3.png (13.55 KB)
token2.png (14.12 KB)
token1.png (15.06 KB)
0 0
replied on July 12, 2017 Show version history

These options are displayed in the Properties pane when you highlight a token activity (Ctrl + 4) or View > Properties.

If you're just double-clicking the activity it will only give you the option to create new token, not Modify a token.

0 0
replied on July 12, 2017

I understand that part.  tokens2 and tokens3 are what appears when I click Modify from the properties pane. 

0 0
replied on July 12, 2017

Which activity specifically is selected in those screenshots?

Can you get a screenshot that includes the full properties pane, the highlighted activity, and the "activities" list (like the Token 2 image) all in view with "Update Token Activities" selected/highlighted, all in the same view.

The screenshot is showing a "Token Calculator 2" activity as an option and I don't see that anywhere in your workflow.

0 0
replied on July 13, 2017

the image is of 'Assign Token Values' task with the 'Assign Token Value' which appears when 'Modify' is clicked in the properties pane to the left. 

token2.png
token2.png (76.19 KB)
0 0
replied on July 13, 2017 Show version history

You're not selecting the right activity, the one you have highlight is the one where you first created Token 1, you need to select the one that appears within the loop.

0 0
replied on July 13, 2017 Show version history

token task from 'for each entry' loop.

token.png
token.png (54.42 KB)
0 0
replied on July 13, 2017

Now we're getting somewhere! smiley

Select "Assign Token Values 1" as the Activity, then select your multi-value token from the Token drop down.

0 0
replied on July 13, 2017

done.

0 0
replied on July 13, 2017

With that selected it should give you the "Append" option as long as you chose a multi-value token. If that's not an option, please send a screenshot.

0 0
replied on July 13, 2017

so based on what I am seeing a token must be set in order to 'append token value'...

0 0
replied on July 13, 2017

Yes, because you can't append (add) to something that doesn't exist.

You can create a multi-value token with multiple values all at once, but that only works if you have ALL of those values available.

To accomplish what your doing (tracking each entry in a loop). You have to Create the multi-value token FIRST so you have a place to store your data, then add/append items to that list as you go through the loop.

If you try "creating" the token in the loop, it is just going to dispose of the old one and create a new one each time you go through the loop.

0 0
replied on July 13, 2017

okay, how am I tracking the token after the loop?

0 0
replied on July 13, 2017 Show version history

So in your loop, you append each entry ID. Next in your find entry activities, you set that token for the Entry ID, but you right-click, select Token Editor, and set the Index to match the branch of the conditional parallel (1 for 1st, 2 for 2nd, etc.)

That would look something like this (note that you'll need to fix your conditions too before this will work)

So, to get the 1st value in the multi-value token you use %(Token 1#[1]#), the second value would be %(Token 1#[2]#) and so on.

The condition checks the Count we put into Token 2 after the loop to make sure there's a value to retrieve, so if Token 1 has 3 items, you hit branch 1, 2, and 3. If it only has 2 items, you hit branches 1 and 2, but not 3, and so on.

So basically, the 2 main tokens you to make this all work

  1. Token 1 - List of all entry IDs from the loop
  2. Token 2 - Count of how many items are in the list

Once you're confident you have everything working, I would rename the tokens to something more descriptive.

0 0
replied on July 14, 2017

so I cleaned up my wf.  hopefully it makes more sense. 

 

I didn't add all the branches to keep down the clutter.  I am still unable to get ALL of the attachments.  I included the email because I am getting a .lfe shortcut but I don't know why. 

any thoughts?

email-attachment.png
test_attachWconditional.png
0 0
replied on July 14, 2017

It looks like you need to modify your search to only include documents, or check whether or not the CurrentEntry is a document before adding it to your multi-value token/list because that search could potentially bring back Folders, and that seems to be what happened.

My guess is that if you open that LFE, it is going to take you to a folder and not a document.

However, if you're only looking for documents in a particular folder, you should be using a Find Entries activity and not a Search Activity. Find entries will give you much better performance and provides the same options if you're not using extra filters based on metadata.

0 0
replied on July 17, 2017

the short-cut attachment has to do with the Find Entry activity.  

 

Find Entry gives one result only in this instance it is a shortcut to the folder and not any of the documents contained in that folder.  

 

0 0
replied on July 17, 2017

In that case, it is expected behavior. Attaching a folder to an email is only going to yield an .lfe shortcut, not the document within the folder.

0 0
replied on July 18, 2017

I am pointing to the correct folder, which contains the documents (more than one) needed to be attached in email activity.

 

Currently there is no way to attach all six documents in the email activity.  Tested and tracked all tokens.  Token 1 has multi-values (1, 21, 31, 41...) Token 2 has no value/output

0 0
replied on July 18, 2017

Ramika,

The approach you're attempting to replicate does work to attach multiple documents to an email.

However, the problem is the way you are assigning your token values, conditions, and Find Entry parameters.

I think it would help if you build this out one step at a time to get a better idea of what is happening in each step, and referencing the Workflow documentation on tokens to get a better idea of how those function will also help.

In the most recent screen shot, none of your activities are tracking the document entry IDs, and your Find Entry activities are looking at an arbitrary value that has nothing to do with the Entries in the loop.

The activity parameters should match what I posted in an earlier screen shot.

This is a relatively complex workflow, so the only way it is going to work is if every token, condition, and parameter is using exactly the right value.

 

0 0
replied on July 18, 2017

based on your post I have updated the wf to only use token 1 since it is the only token that returns values.  Using token one works.  I get three attachments on the email.  However, the attachments are .lfe instead of the tokened documents.  

0 0
replied on July 18, 2017

Like I said, you're not referencing the Entry IDs in your Tokens, and you're not indexing the multi-value token in your Find Entry activities.

The way it is configured now, if you do get any entries back, it is going to be a different entry than you're expecting, and every attachment would lead to the same Entry.

0 0
replied on July 18, 2017 Show version history

token one is the multivalue token.  How can I make this wf work. 

token1Results.png
token1used.png
token1used.png (47.14 KB)
0 0
replied on July 18, 2017 Show version history

Yes, but those aren't the Entry IDs of your documents, that's just the Loop iteration combined with a "1" so it isn't going to give you what you want.

You can look at this page for guidance on how to use and manipulate token values.

0 0
replied on July 18, 2017

Thank you for the link on token editing.  I suppose I should use the tokens within the email rather than trying to 'attach' to the email?

0 0
replied on July 18, 2017

No, not at all. Including tokens in the email won't give you the documents it will just put text into the body of the email.

The issue is that you're not retrieving the correct entries because your token values are wrong. The documentation should help.

However, I really think you'd benefit testing this one step at a time to see how everything works as you add each piece instead of trying to get it all working at once.

0 0
replied on July 18, 2017 Show version history

Again thank you for all your help.  Even if I change Token 1 to equal Entry_ID or Entry_Name there is currently no way to get that information to correspond to an actual attachment.

Entry one works because it is set to the last variable (doc name) run in the 'for each entry' loop.  

test_attachWconditional-expanded.png
0 0
replied on July 18, 2017

You really need to break this apart and take it one step at a time. Each screen shot shows changes to a bunch of conditions so it is going to be incredibly difficult for you to pinpoint the source of the problem with so many things changing.

Start a new workflow, and add one activity at a time. Make sure it does exactly what you need it to do before you start adding the next activity. For example, you have "Track Tokens" and "Assign document Name" outside of the loop so it only runs after the loop is finished, not for each document.

You're getting a LOT closer on the Find Entry activities, you just need to use Entry ID in the "Change Token for Each Entry" and use Indexing in the token editor for the multi-value token because you have to tell workflow which of the values to use.

0 0
replied on July 18, 2017

Thank you again for your recommenation.  However, breaking the wf apart would not be beneficial.  

 

As is stands the wf works as expected.  Actually, I would have this solved if I could send the docs as a .zip file.  However, our network environment does not allow .zip files.  Which is why I need a way to capture each attachment and attach it to an email for sending. 

I know the token 1 (multi-value) is working because the doc names are printed inside the email just as they are listed in the folder the items get moved to using the 'for each entry' loop.  

 

token 1 = names of all document (all 6 are set inside 'for each entry')

token 2 = (token 1) outside of 'for each entry' ==> token 2 never gets set

 

I use branch one for testing.  If branch one sends an attachment then I move the same setting to branch 2.  However, a document has never been sent over branch 2.  It would be great if I could access %(ForEachEntry_CurrentEntry_Name) could be set outside of the for loop or if Token 2 could access the values in Token 1.  

0 0
replied on July 18, 2017

Have you looked at the completed workflow to see how the branch 2 condition is being evaluated? That information would be very helpful.

0 0
replied on July 19, 2017

I've attached some results information for wf

wf-summary.png
wf-summary-messages.png
wf-summary-condition3.png
wf-summary-condition1.png
wf-summary.png (60.71 KB)
0 0
replied on July 19, 2017 Show version history

It looks like the first reason your conditions are failing is because you entered the "#@Count#" text directly into the token. You have to use the Token Editor to get a count, index, etc.

Also, this is reason I suggested earlier that you build this out one step at a time.

Looking at your current error messages it looks like you've changed a lot of values since the last time around, and it is going to be nearly impossible to solve this with so many changes.

0 0
replied on July 19, 2017 Show version history

actually, token editor is not available in the wf as it stands.  The only place I can edit a token is within the email text of the email activity.  

0 0
replied on July 19, 2017

When you select a token value to enter, right-click the token it puts in the field. The token editor is available in all versions of Workflow.

0 0
replied on July 19, 2017

So token 2 index works.  What should I be looking for in the condition for branch one?

0 0
replied on July 19, 2017

You should be looking at the Count of items in your multi-value token (entry IDs) and storing that as Token 2 (not a multi-value, just a Count of items in Token 1). 

In that case, the conditions would be like these:

0 0
replied on July 19, 2017

token 2 count

Token-count.png
Token-count.png (11.98 KB)
0 0
replied on July 19, 2017

Not quite. After the loop, set the value of Token 2 = %(Token 1#@Count@#)

So if you capture 6 entries in the loop, Token 2 should equal 6

Then your condition should be "If %(Token 2) greater than 0"

0 0
replied on July 19, 2017 Show version history

find entry One ==> this results in a folder link and not a file... is there something I should use instead of "Find Entry"

Token-count.png
0 0
replied on July 19, 2017 Show version history

I'm sorry, let me clarify.

The Find Entry should use the Index on Token 1 (the entry IDs) you add in the loop.

The Branch (Branch 1 - Document 1) should use the condition I mentioned above.

To make things easier, just remember that a Condition is anything with an "If" but the value you put in the Find Entry is a parameter.

 

Find Entry is always the ideal if you have the Entry ID, and Find Entries is always better than a Search if you want all docs and/or folders within a specific folder/location.

Think of Entry ID like an address, whatever number you put in the Find Entry looks for the document or folder at that address, if you put at Entry ID into a Find Entries it will direct you to everything housed in that location.

1 0
replied on July 20, 2017 Show version history

Thank you for your Help!

0 0
replied on July 20, 2017

No problem. Did you figure out how to get the Entry IDs into Token 1 so you can use the index?

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

Sign in to reply to this post.