How to use a variable for multi-Branches with out creating 100's of variables for the same data

  • 14 November 2018
  • 6 replies
  • 0 views

Badge +2

I have a workflow that has three branches, which will have more.  In each of the branches I keep asking for the same information example LastName, date, etc...  Can I use the same variables in each branch, instead of creating variables that look like this:

slotLastName-1

slotLastName-2

slotLastName-3

Each of the run parallel action branches look like the png file I attached.

I have to make three more of these branch's and it would be nice if I could do it a bit easier than I currently am.

Derek


6 replies

Userlevel 6
Badge +16

There could be many ways of work with that. I think in the following approach:

-Add your LastNames (and all other information to other collections) to a collection

-Then loop the LastNamesCollection

-get the information of the other collections based on the current index of the looped one

-Do your magic

-Close the loop

Userlevel 5
Badge +14

When you say: "In each of the branches I keep asking for the same information"

Do you mean that each branch has a Task Form or some other means of input in which User Data will be collected and can change based on whoever is entering / providing said data during the lifecycle of the Workflow? 

So: 

  1. Workflow Starts
  2. Billy Baker interacts with a Task Form or Approval and their user name ("BBaker") is captured and used in some meaningful way before stepping to the next branch...
  3. Lisa Lilly interacts with the next Task Form or Approval and their user name ("LLilly") is captured and used in some meaningful way before stepping to the next branch...
  4. etc... etc...

If that's the case you could literally just hookup something on the form to your Workflow variable so that it'll capture after every instance of where a user could interact with it. 

However, if for some reason you can get this information without having users do anything meaningful, you could always just either grab it as soon as the workflow starts (that way if it restarts, no big deal), or simply overwrite the data inside of those workflow variables with whatever *should* be there every branch. 

You could also create a State Branch that handles this, and is activated after every point in your workflow where you need this to happen. 

 

I hope some of that helps. It's difficult to say without seeing more of what your workflow is doing or how you're getting any of the information, but I can't imagine that it'll be too difficult to find a solution. 

Badge +2

There are no task actions, it's just pulling data from one list and then putting it into an HTML email.

Userlevel 5
Badge +14

If you're just pulling in X amount of data from a list, then like Fernando suggested above, throw it into a collection variable and parse them via a loop. 

Userlevel 5
Badge +14

if all the branches do the same, I'd suggest to move whole branch logic to a separate (site) workflow.

then within each branch you just start separate instance of the workflow and (may) handover it a parameter(s) whom should it collect data for.

Badge +3

in my opinion the best way would be to collect all the relevant items in a "Query List" action and collect IDs in a collection varibale. Then you can use a "For Each" action to get the data from each item and put it into collection variables which you can use for further activities...

Reply