Add A Record To A Table Variable In Copilot Studio
Add A Record To A Table Variable In Copilot Studio Posted by - Matthew Devaney on - June 29, 2025 1 Comment You can add a record to a table variable in Copil...
- Published
- Reading time
- 5 min read
Before you start
Is this guide for you?
- Best entry point
- Microsoft Copilot Studio
- Time investment
- 5 min read
Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/add-a-record-to-a-table-variable-in-copilot-studio/. Author: Matthew Devaney.
Add A Record To A Table Variable In Copilot Studio Posted by - Matthew Devaney on - June 29, 2025 1 Comment
You can add a record to a table variable in Copilot Studio using a hidden node type named EditTable. The EditTable node can only be added through the YAML code editor. It also gives the ability to remove a record, clear the table, or take record from the start or end of the table. Table of Contents
Introduction: The Project Staffing Agent
Create A Table Variable In The Start Conversation Topic
Add A Record To A Table Variable In Copilot Studio
Remove A From A Table Variable In Copilot Studio
Clear A Table Variable In Copilot Studio
Introduction: The Project Staffing Agent
Planners at a consulting firm use an Agent to manage their project teams. A planner can ask the agent to add a team member to a project, remove a team member, or clear the entire project team.
Create A Table Variable In The Start Conversation Topic
Open Copilot Studio and create a new Project Staffing Agent .
Use the following description and general instructions: Description:
The Agent will add or remove people from a Project Team. General Instructions:
1. Follow these steps in order: 2. Determine whether to add a team member, remove a team member or clear the entire team Run one of these topics: “Add Team Member To A Project”, “Remove Team Member From A Project”, or “Clear Project Team”. Go to the Conversation Start topic .
In the Conversation Start topic we want to create a new table variable named Global.ProjectTeam . This variable will track who is currently on a project team.
Use this formula to initialize the variable with 3 team members. This table variable only stores the consultant names but it is possible to add additional fields like email, phone number, etc.
Table ( { Name : "Matthew" }, { Name : "Vivek" }, { Name : "Angela" } ) Code language: CSS ( css )
Also, edit the existing message node to display this text. Write a formula to display the initial project team as a bulleted list. Hello, I'm the {Bot.Name}. The current project team is: < ul >
{Concat(Global.ProjectTeam, " < li > "&Name&" </ li > ")} </ ul > < br />
What would you like to do next? Add a team member, remove a team member, or clear the entire team? The current project team is: < ul >
Concat(Global.ProjectTeam, " < li > "&Name&" </ li > ") </ ul > < br />
What would you like to do next? Add a team member, remove a team member, or clear the entire team? Code language: HTML, XML ( xml )
Add A Record To A Table Variable In Copilot Studio
To add a record to a table variable we will insert a hidden Edit Table node through the code editor. It does not appear as a selection in the Copilot Studio nodes menu.
Create a new topic named Add Team Member To A Project .
Setup the topic as shown in this screenshot.
The Add New Record To Table action must be added using the code editor.
Insert the EditTable action after the question node.
Copy and paste this YAML code into the code editor.
- kind: EditTable id: editTable_tRec0l displayName: Add New Record to Table changeType: Add itemsVariable: Global .ProjectTeam resultVariable: Global .ProjectTeam value: "={Name: Topic.PersonName}" Code language: PHP ( php )
The hidden EditTable action will now show in the topic and with these properties.
Remove A From A Table Variable In Copilot Studio
If we want to remove a record from table variable we can also do it through the Copilot Studio code editor. Create a new topic named Remove Team Member From A Project . Design the topic as show in this image:
Open the Copilot Studio code editor and copy & paste this code below the question node to create a new EditTable node.
- kind: EditTable id: editTable_XYZ123 displayName: Remove Record From Table changeType: Remove itemsVariable: Global .ProjectTeam resultVariable: Global .ProjectTeam value: "={Name: Topic.PersonName}" Code language: PHP ( php )
The EditTable node will show in the topic editor and its action property is set to remove a record from the table variable.
Clear A Table Variable In Copilot Studio
Clearing a table variable in Copilot Studio is also possible by writing YAML in the code editor. Though we could also do this by setting the table variable to Blank() it is still useful to know an alternate way.
Add a new topic to the Agent named Clear Project Team . Build the topic as shown below:
Copy and paste this code into the YAML editor. - kind : EditTable id : editTable_345Tla displayName : Clear Table changeType : Clear itemsVariable : Global .ProjectTeam resultVariable : Global .ProjectTeam Code language: CSS ( css )
Then the Clear Table node will appear in the topic editor with these properties. Did You Enjoy This Article? 😺
Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?
If you have any questions or feedback about Add A Record To A Table Variable In Copilot Studio please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Copilot Studio Video
Video: Copilot Studio – Add Human Review to Your AI Agents
Tagged
Microsoft Copilot Studio
Have a Microsoft 365 topic idea?
Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.
Keep learning Microsoft 365
Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.
Continue learning
Related tutorials
Related questions
Related comparisons
Next action