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

Question

Question

Find User within a Try Catch within a For Each row is not updating (after manually assigning token values)

asked on December 9, 2014

In the attached workflow, I am trying to use a Try-Catch within a For Each loop.  If a user is not found, the error is caught, an alternate name is looked up, and I assign those values to the original Find User tokens.  However, after that token assignment, all subsequent Find User activities will not update (they will stay with the Assign Token Activities values in the catch) until that activity is called again.  

Is there some way to clear this out, so that on the next row, my Find User activity will work?

Capture.JPG
Capture.JPG (70.7 KB)
0 0

Replies

replied on December 9, 2014

Samuel,

I would suggest to first create a token at the start of your loop before the try-catch with a blank value. Then, every time you have to adjust it in either of the branches, modify that same token you created earlier. This way no matter which branch happens you will have a token that is usable and it will always start fresh without a value. I also think you are missing a token modification on your left most branch. to set the token in case that side fires.

1 0
replied on December 10, 2014

Hi John,

What you suggested works well - I created a set of tokens before the loop, and set those tokens using each Find User activity.  However, I still am curious why the Find User activity in the leftmost branch is not updated after the assignment is called in the middle branch.  This seems like unpredictable behavior (at best), or some sort of variable conflict at worst.

Thanks for the help!

0 0
replied on December 9, 2014

I'm using the tokens that are in the Find User activity.  So, the Assign Tokens activity in the middle branch assigns values to the tokens in the leftmost Find User activity.   On the next row, if the Assign Tokens activity has fired, the Find User does not find the new user - it's values are stuck on the last one, until that Assign Tokens activity is called again, even though the Find User activity should be being called with new values on each iteration. 

 

0 0
replied on December 10, 2014 Show version history

Working with Sam on this and we think there's a variable clash issue with local/global scoping perhaps. It does work just fine if we create a new set of tokens and explicitly assign the values of the find user activity into this new set of tokens.

 

When using modify token activities be careful when modifying tokens created by other non-token activities. For example, Find User, creates its own tokens. Modifying them appears to have a duplicating effect in memory such that the original tokens can no longer be referenced later in the workflow if desired but only the modified tokens. This may be due to tokens being initialized then later referenced and during the referencing only finds the most recently initialized token or the largest scope variable?

It appears variable control is restricted to the designer as no errors or messages were reported?

 

replied on December 22, 2014

This is actually expected behavior. Tokens have scope, but additionally, tokens that are specifically assigned, through Assign Tokens for example, take precedence over tokens generated by activities. This was done to minimize the potential conflicts between data and data types in activities that may generate the same token.

John's suggestion of creating a separate set of tokens that you specifically assign in either branch is the recommended configuration.

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

Sign in to reply to this post.