Flow Designer & List Collector "For Each": A low-code solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2024 05:58 AM - edited 03-11-2024 08:56 AM
Purpose: To develop a Catalog Item where end-users can select multiple Records/Options via a List Collector, and Flow Designer is able to differentiate and provide the desired action(s).
Background: For our purposes, we wanted to provide a List Collector Variable (referencing our Business Applications Table) where our end-users could select multiple Applications and, based on the selection, certain actions would take place or tasks would generate.
NOTE: As of writing this, we are on Vancouver Patch 4.
We had gone through several iterations of development trials/errors in Flow Designer to have our 'If' Statement recognize the differences between CI Records, through creating Flow Actions and MLVS on the Catalog Item, but none would work. The solution will keep you in a Flow (without creating any Actions) and utilizes the newer Function (fx) capability.
Some of the notes below are the 'typical' for Catalog Item Flows are created, but I wanted to provide all of the details from the top for full clarity:
Step 1: Trigger = Service Catalog
- This is the initial point to trigger the Flow where, when the Catalog Item is submitted, then follow these Steps.
Step 2: Get catalog Variables from...
- Here is where you'll associate the List Collector Variable to your Flow and ensure you can reference it in later Flow Steps.
Step 3: Look up the List Collector Records.
- The key points here are using the 'Look Up Records' to ensure you'll have the data from each/every record selected in the List Collector Variable.
- On the 'Look Up Records' step, you'll match up the Conditions where the Record SysID IS ONE OF dot walk from the List Collector Variable Records to the SysID.
Step 4: The 'For Each' Step
- This will run through each and every Record selected on the List Collector Variable.
- On the For Each, you'll select the Records that were looked up in Step 3.
- Here is where you'll add the Function onto the captured List Collector Records. To do this:
- After completing the Records selection, you'll see the Pill View.
- On here, hover toward the right-end of the Pill and you'll see an icon for +fx.
- Once you've clicked on the +fx, you'll be presented with multiple Function options. Search for Split.
- The use of the Split Function will auto-return an Array.String and this is where you can include a Separator. For us, we used a Comma and a space (, ). Add this into the Separator line followed by clicking Apply.
Step 5: The setting of If Statements, Approvals and Tasks
- Now you'll be able to add the 'If' Statements where/as necessary. While we didn't go through every type of option to see if any other Fields work for this, we confirmed its functionality by Dot-Walking on the 'For Each' Step over to the SysID and a couple of other options on our Business Application CI Record. For the purpose of this example, I'm showing the condition for If the SysID of the selected Record from the List Collector IS the SysID for a Specific CI.
From here, you should be able to perform the remainder of your Flow, Tasks and Approvals as on any other Flow.
I hope this is helpful to those working in Flow Designer and using List Collectors!
Thank you,
Josh Pirozzi
- 8,184 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2024 07:59 AM
Hi @jitendrag!
In your screenshot it looks like you're missing the Fx (Function) on the For Each Step. When you hover over the For Each (usually toward the right side of the pill), an Fx circle should appear. From there, you'll add the Split Function along with adding a comma as the separating character.
Hope this helps!
Josh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2025 11:27 AM
For each only works when you are using "Look up records" and doesnt support "Look up record"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 04:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 01:03 PM
Hey @jyotisaroj,
It looks like your 'For Each' Flow Step isn't nested under the 'Look up Records' Flow Step, so it might not query the Table you're referencing.
I'd also recommend configuring the Flow like this:
- Pull selected Variables
- Look Up Records where sysID is sysID on the selected options (as you have configured in 11.png attachment)
- Move your 'For Each' beneath the 'Look Up Records' Step you have configured.
- Add a 'Look up Record' beneath the 'Look up Records'
- This will give you a clean Single Record look up and will run through the remainder of your Flow for that single record before looping back to look up the next selected record.
- Then add your 'If' Statements beneath the 'Look up Record' Step.
- Reference the 'Look up Record' Step in your 'If' Statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 06:47 AM
Thank you @Josh Pirozzi