Skip to main content

I have a couple of loops running.  The first for each group is a list of roles like: safety, director; operations

each role can contain up to 5 assignees.

Thus my second loop needs to assign the actual name to a variable.

For example;  lets say we are at the role "safety" and in that role there are 3 assignees; Bob,John,Kate

Thus I would like to assign

safety1 = Bob

safety2 = John

safety3 = Kate

  What I would like to do is pre-create all the variables ; ie safety1, safety2, safety3, etc..

Then when the loops are running.  assign the variables to their appropriate assignee.

Looking at the set variable action, I need to use a drop down selection.  Is there a way to set the variable by concatenating 'safety'&'loopcount' as the variable name, which has previously been created then set its value?

Hope that makes sense.  Thanks for your input.

I'm not aware of anyway to dynamically create a variable.  However, if you created a list to store your departments and roles, you could easily query that list from the workflow and find the appropriate roles based on the departments.  For your scenario you could then store the 3 safety people in a collection variable and loop through it doing whatever actions you needed.  This approach also gives you greater flexibility in the future for updating roles without having to modify the workflow. 


Hi Brendan,

Thanks for the idea.  Actually the roles are static and I do read them in.  It's the assignees that will be dynamic for each role.  There may be 1, none, 5, etc per each role and they will all certainly be different people each time the workflow is called.  I can make this work, but it's a lot of repeated actions within if/then statements and switches which will make the workflow, to quote our new president, "Huge".  This may work well with walls but not workflows ;-)

I don't really see a way around it though


When I said "roles" I meant the person assigned to that role.  So you create a list with 3 columns, Department, Role, Assignee.  You load all your assignee's in the list with the role and department they go with.  You can then query that list in the workflow to get your collection of assignee's.  Then you can do what you need to with those assignee's.  No need to repeat actions.  You use a For Each and then just loop through the collection.  


Hey ‌!

Did ‌'s suggestion help you out? If so, please mark it correct!

Thank you!

Rhia


Reply