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

Question

Question

In Workflow, are tokens local or global?

asked on March 20, 2014

I hope that title makes sense.

 

I have part of a workflow I am working on - sort of a fancy approval.  It has a conditional parallel that splits into a number of approvals which can happen in parallel.

 

Each of those branches has similar steps.  I had a thought that it would be really easy to set a token value at the start of each of these branches to apply to that branch.  For example, setting "System=A" or "System=B" as the first step of the branch.  This makes it easy to copy and paste to make a new branch while only changing the token assignment.

 

So... before I set up a test...  are tokens like this - in sections of a conditional parallel - local or global?

 

(The more I think about it, I'll probably just use "invoke workflow" to call another workflow for each branch, but it would still be useful to know how this works)

 

Thanks!

0 0

Answer

SELECTED ANSWER
replied on March 24, 2014 Show version history

Are you creating the SystemName token in each branch or did you create before the Conditional Parallel and you're modifying it in each branch?

 

Side question, Find Group provides the individual users' emails as tokens, is there another property that you need to get with Find User?

 

EDIT: Ignore what I said above. The Assign Token activities run in parallel (but not simultaneously, rather immediately one after the other) and modify the same token. Hence whichever one is last, sets the value. So the behavior is expected.

 

Is the token needed? Why not just edit the group name when you copy the branch?

0 0

Replies

replied on March 20, 2014

Wait conditions on fields don't support tokens for the field names.

 

Conditional Parallel checks conditions on all branches. I can't quite tell how you're using the token without seeing your workflow, but it sounds like both both branches are running. Your initial post made it sound like you would have multiple approvals in parallel, but from the latest one it sounds like either branch A or branch B is expected to run, but they're not supposed to both run at the same time. In that case, you want a Routing Decision activity, not a conditional parallel

1 0
replied on March 20, 2014

Copy and pasting branches should be fine. The tokens do have scope. You have the global tokens, like Date, Entry ID, Initiator. The activity tokens are created when/if the activity runs and are available to activities that come after it.

0 0
replied on March 20, 2014

The token will be available inside of the sequence and to activities after it, but not between the sequences (sequence 2 can't reference sequence 1's token).

0 0
replied on March 20, 2014

Great!

 

So, what happens if the two tokens are named the same thing?  If each branch has a token called "SYSTEM."  Inside the branch would be fine, I guess, but what happens after when there is a collision?

0 0
replied on March 20, 2014

Any tokens you create will be prefixed with the activity name. If you create the token before the Conditional Parallel, it will be the same token used in 2 places. If you create a SYSTEM token in each branch, they'll be different.

0 0
replied on March 20, 2014

I hate to say it, but... are you sure?

 

The Invoke workflow won't work - I would need to be able to pass it the name of a field to watch for changes, which I don't think I can do.  So...

 

I have two branches set up.  Call them A and B.

 

The conditional parallel runs branch A if field A=yes and branch B if field B=yes.

 

The first action in each branch is "Set Token System=A" or "Set Token System=B", respectively.

 

later on in each branch, I send an email that uses the token SYSTEM.

 

As of right now, those emails both show SYSTEM=B.  (or whatever I make SYSTEM= in the last branch.)

 

 

Does this sound right?

0 0
replied on March 20, 2014

It depends how you are doing it. If you make one token before the conditionals and update it inside them, it will contain the most recent value. If you make individual tokens inside each conditional you will have _ many tokens. You could also make a multivalued before the conditionals and append the systems, then you'd have one token with all applicable values in it.

 

As for using invoke workflow, you would need to setup Workflow Parameters

0 0
replied on March 24, 2014

I'll try to fill in more info about this workflow farther down in another comment...

 

Now that I think about it, you are right.  I was looking at the equivalent of passing a pointer to a field, which you can't do, but I guess I could do the equivalent by passing the token in a parameter, then using the return parameter to set the value of the field.

0 0
replied on March 24, 2014

I've convinced myself again that this can't be done this way.  Please tell me why I'm wrong...  :)

 

The initial workflow looks like this:

 

  • Receive original request for new systems access, check for proper fields filled, etc.
  • Send an email to team for initial approval/denial
  • If approved, invoke workflow (maybe) in parallel on many branches, one for each work team which must implement the approved changes.

 

The piece I would like to duplicate looks like this, one for each system which has been approved:

  • Send an email to the team responsible
  • Wait for the field to change,signifying the change is complete.
  • Escalate/nag as necessary

 

I'd like to make that second part modular - the goal of this exercise - but the field that we need to watch for changes is DIFFERENT for each branch.

 

For example, if they have requested access to Laserfiche, a field called "LF Access" must be watched for it to change from "Access requested" to "Access implemented."

 

So, I think I would need to pass to the "implement workflow" somehow a pointer to the field I need it to watch.  I don't think you can do that.

 

I guess I'm thinking of the Invoke Workflow like a function, and it IS in many ways but not this one.

 

But again - please tell me I'm wrong.  :)

0 0
replied on March 24, 2014

Maybe this will help:

This is dev, so my action names aren't exactly descriptive yet :) but I hope this conveys the issue.

 

These branches (and many more, hopefully) all run in parallel, each one contacting a different group of users for them to perform a task and then change a field when they are done.

 

The Token, as I would like it to work, should be the only thing I set for each branch when I copy/paste for a new system.  It will look up the Group of users and email them, then wait for completion.

 

BUT - as it stands now, the workflow snippet above will perform both actions to the group "LF."  If I swap the two token assignments, it will perform both actions to group "NetworkAccess."

 

Does that explain it better?

0 0
SELECTED ANSWER
replied on March 24, 2014 Show version history

Are you creating the SystemName token in each branch or did you create before the Conditional Parallel and you're modifying it in each branch?

 

Side question, Find Group provides the individual users' emails as tokens, is there another property that you need to get with Find User?

 

EDIT: Ignore what I said above. The Assign Token activities run in parallel (but not simultaneously, rather immediately one after the other) and modify the same token. Hence whichever one is last, sets the value. So the behavior is expected.

 

Is the token needed? Why not just edit the group name when you copy the branch?

0 0
replied on March 24, 2014

Ah, so I'm not crazy.  :)

 

The token isn't mandatory, but nicer.  I would use that token to set the group name once, and then use it to get the list of users to send the email, and in the actual email so the recipients know which system to change, and in a "history" logging field.

 

It would be nice to be able to copy and paste the branch, then set the one field at the top to modify the entire branch.

 

 

Thanks for the clarification!

0 0
replied on March 24, 2014

The activities get renamed when you copy and paste, so you'd also have to change the token you're using in Find User (since I'm assuming you're using one from For Each User).

 

Do you need to send individual emails to each user in the group? You could associate a mailing list with the group and just email that if you don't need personalized emails.

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

Sign in to reply to this post.