AI Business Solutions

Foreach is officially added to Copilot Studio!

Zewei Song, Ph.D.
August 26, 2025

In an article published late last year, I described an undocumented CopilotStudio designer element called Foreach, which is designed to loop through all records in a table object. This element can be used in custom topics to iterate over structured data and get some cool results.

Fast forward to eight months later, I just noticed it is officially added to CopilotStudio's designer. You can find it under Variable Management -> ListManagement:

Once you add it, the UI looks exactly like late last year's:

In above case I set it up to loop through all records in a table value called GetItems.value, which is returned from a Copilot Studio tool (used to be called action) to get items from a SharePoint list. The foreach loop variable is called LoopValue1, its type is record.

Other cool elements available are "continue" and "break" in a loop:

  • Skip to next item in a loop: Like "continue" in most programming languages, this skips the current loop iteration and starts the next.
  • End loop: Stops the loop and proceeds to the following element. Below is an example of using "Skip to next item":

Here is a code-behind example:

1      id: foreach_1BGYSa
2      items: =Topic.GetItems.value
3      value: init:Topic.LoopValue1
4      index: init:Topic.LoopIndex1
5      actions:
6        - kind: ConditionGroup
7          id: conditionGroup_KEjf8H
8          conditions:
9            - id: conditionItem_bmvAr1
10              condition: =Topic.LoopValue1.Title = "************"
11              actions:
12                - kind: ContinueLoop
13                  id: g7a2fq
14
15        - kind: SendActivity
16          id: sendActivity_Ig349K
17          activity:
18            text:
19              - "{Topic.LoopValue1.Title}: {Topic.LoopValue1.Description}"
20            speak:
21              - "{Topic.LoopValue1.Title}"

I am very glad this very useful designer element is officially added to Copilot Studio. Meanwhile, I have found another "minor" undocumented feature which I will blog about in near future.

Until then, happy piloting Copilot my friends!

Disclaimer

The content on Invoke, LLC's blog is provided for general informational purposes only and focuses on IT-related topics, including technology trends, software, AI, cybersecurity, and industry commentary. While we strive to provide accurate, up-to-date, and high-quality information, we make no representations or warranties of any kind, express or implied, about the accuracy, reliability, completeness, or suitability of the information, tools, or resources shared on this blog. Any reliance on such content is at your own risk.

The opinions expressed in our blog posts are those of the authors and do not necessarily reflect the official views of Invoke, LLC. Our blog may include links to third-party websites, software, or services. We do not endorse or assume responsibility for the content, functionality, security, or practices of these third-party resources.

The information on this blog is not intended to replace professional IT, technical, AI, or cybersecurity advice. You should consult a qualified IT professional before implementing any solutions, configurations, or strategies discussed on this blog. Invoke, LLC and its affiliates are not liable for any loss or damage, including but not limited to data loss, system downtime, or security breaches, arising from the use of or reliance on this blog’s content.

We reserve the right to modify, update, or remove content on this blog at any time without prior notice.

Invoke combines tightly coupled security controls and digital productivity solutions.

WANT TO LEARN MORE?

Invoke’s system integration solutions maximizes your Microsoft investments through exclusive programs, expert access, cost optimization, proven methodologies, and industry expertise.

PROFESSIONAL SERVICES

Microsoft
Entra
Microsoft
Defender XDR
Microsoft
Purview
Microsoft
Intune
Maximize Your Microsoft Investments 
Optimize Costs and Efficiency
Unified Security
Operations
Let’s talk about how we can help bring you the power and digital innovation of Microsoft technologies to your business!
Thank you! We have received your information and will contact you shortly!
Oops! Something went wrong while submitting your information. Please try again in a few minutes!
© Invoke, LLC 2025