How to dynamically get requested item variables in a subflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2023 08:07 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2025 12:06 PM
For me, I ended up creating a custom subflow with a custom action to just take the trigger inputs (that already includes all the information I'd need) & query the sc_item_option table (and new?, can't remember... we're in upgrade, so I'm not looking at it directly) to get everything I needed. Of course, this was all to just get the RITMs set dynamically getting catalog item variables. The dynamic flows/subflows was where I was going to perform any logic that fell outside of the norm. In either case, sure... I/we could work around it "customly", but hope that at some point in Flow Designer's future, it could truly be dynamic with something out of the box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 10:12 AM
@Maik, if I had to guess, gjz means this in the "Get Catalog Variables" OOB action from ServiceNow. I too think this is very much desired & you're correct, we could use common variable sets. However; the fact that I can't dynamically set the "Template Catalog Items and Variable Sets" doesn't do us as developers any good to start to standardize "templated" workflows where we do have variable sets. This here would be what myself, and I assume gjz are after(the ability to place the request/RITM's Catalog Item field in here to dynamically gather these):
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 10:24 AM
@Ben Cuddington - You are 100% correct, I was trying to figure out how to make a reusable subflow with dynamic variables, but it isn't possible for the reason you stated. I'm very disappointed the "Get Catalog Variables" and "Create Catalog Tasks" actions aren't dynamic, which would allow me to create reusable subflows. I'm currently maintaining 6 flows with the same 30+ steps because I can't reuse subflows. I did create an Idea on the Idea portal for this, but with their new rating system I'm not sure it will ever be considered.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 06:32 AM
Thanks gjz, I'm glad we're on the same page. It's weird that this isn't already incorporated. ESPECIALLY @Maik Skoddow with the Dynamic Flow situation. This would be perfectly suited to truly get re-usable flows to Production.
As it stands, I have had to custom script an action to get variables dynamically; but I can't use them in a useful way as I'd like because of this.
This scenario is also true of the "Create Catalog Task" OOB action as well. Since it also asks the same question, when this should be auto-set by the trigger/RITM's catalog item field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2025 12:10 PM
I found a work around for this:
- Create a String type Flow Variable called "Item Name".
- Assign "Trigger - Service Catalog > Requested Item Record > Item > Name" to the Item Name variable.
- Create a series of If statements like this: if "Flow Variables > Item Name" is "Name of catalog item".
- In the if statement, use the Get Catalog Variables action to get the variables for that catalog item.
- Assign the catalog variable to a generic Flow variable.
This is a bit clunky and of course, this only works if you need the same variables from all of the catalog items. But it does allow you to maintain only one Flow for multiple Catalog Items.