How to dynamically get requested item variables in a subflow?

gjz
Mega Sage

I'm just now dipping my toes into Flows/Subflows and have a question about how to set up a subflow for requested items. 

 

I currently have several workflows that order hardware, I would like to put the order steps into a subflow, but, I need the variables on each requested item to display on the subflow because they hold information about what needs to be ordered.  How can I get the variables dynamically in the subflow?

 

For example, I have a computer catalog item and a monitor catalog item.  In the current workflows for both, they have identical order/receive steps, but the information used to order them is different.  I want to create a reusable subflow for the order/receive steps, but the people doing the work need to know what to do based on the variables.

 

Any ideas?

11 REPLIES 11

Maik Skoddow
Tera Patron
Tera Patron

Hi @gjz 

not sure whether I got your question, but to be able of reusing Subflows you should use a common variable set among all catalog items which holds all required information to fulfill the order. 

But any kind of dynamic variables is not possible, as the whole concept of (Sub-)Flows requires fixed variable names.

Hi Maik, 

You understood my question just fine - thanks!  One of the thoughts I had was to have in input variable that is JSON-like or key-value pair of some sort and use that to parse the information, but I don't have any experience with that, either.  Would that be a possibility as a common variable set?

You might be on to something with that. Just thinking out loud here, but perhaps a custom action to look up the variable values for the given request item, then output the results as an array of objects (name/value pair). This might help: Docs: Create a custom action to generate an array of objects from a list of records 

 

Came here looking for a similar solution, and I think you've inspired me to create that solution.

I ended up creating a custom action to generate an array of objects from a list for a different issue that does work.  I created it on the base of someone else's solution, unfortunately I don't remember which person.  

 

I think the biggest issue with a subflow is you have to pass in the name of the catalog item, you can't do it as a variable or a data pill.  It's a shame, it means subflows really aren't reusable as advertised.