Copilot Studio: Detect Multiple Entity Types In A Question

In Copilot Studio you can detect multiple entity types (name, email, etc.) in a question node by choosing to identify “one of multiple entities”. Then after the User responds to the question, we determine which entity type was entered and perform a search on it. This is useful for giving options to lookup a database record like membership details with many potentially unique values.
Table of Contents
• Introduction: The Membership Information Agent
• Create An Agent In Copilot Studio
• Add A Question Node And Identify One Of Multiple Entity Types
• Define A Custom Entity With Regular Expressions
• Add A Condition To Determine The Entity Type
• Setup A SharePoint List With Member Details
• Get Items From The SharePoint List Using The Lookup Value
• End The Current Topic Inside The Else Condition
• Display Membership Details To The User
• Redirect The Agent On Conversation Start
• Test The Copilot Studio Agent With Multiple Entity Types
Introduction: The Membership Information Agent
Employees at a Fitness Club use a Copilot Studio Agent to lookup membership details. The employee can enter the member name, email or membership number to retrieve the member record.

Create An Agent In Copilot Studio
Open Copilot Studio and create a new agent named Member Services Agent.

Include the following description and general instructions:
Description: The Agent will help the User get membership details. General Instruction: The User will enter a Member ID, Member Name or Email and the Agent will retrieve Membership details. |
Go to custom topics and add a new topic named Lookup Membership Details.

The topic will trigger when the Agent determines the intent of the User is to get membership details.

Fill-in the trigger with this description.
This topic will assist the User with finding membership status, benefits, and history by searching for their account details within a database |
Add A Question Node And Identify One Of Multiple Entity Types
We want to ask the User for to provide identifying information about the member (Person Name, Email or Membership Number) they want to lookup. Add a question node below the trigger and use the following question text.

Then choose the information to identify and select One of multiple entities.

Add the pre-built entity types Person Name and Email.

Define A Custom Entity With Regular Expressions
We also want to allow the User to provide a 6-digit membership number to lookup member details. We could use Number entity type here. But it would not ensure the number is always 6-digits. To do this, we need a custom entity type.
Select the New Entity button, then choose Create an Entity.

Choose the option Regular expression (Regex).

Fill-in the new entity with these details:
- Name: Membership Number
- Description: Six-digit membership number
- Pattern: \d{6} (regular expression for 6-digits)

Now the question node has multiple entity types: Person Name, Email and Membership Number.

Add A Condition To Determine The Entity Type
The question node having multiple entity types will output a record type variable. The record includes a property for each entity type. The entity type detected will be filled in with a value whereas the other properties will be blank.
For example, if the User enters [email protected] the record will look like this:
{
'Person Name': '',
'Email': '[email protected]',
'Membership Number': ''
}
Searching the member details uses a different query for each entity type. Therefore, we must add multiple conditions to the topic. Add these 3 conditions below the question node:
- Person Name is not blank
- Email is not blank
- Membership Number is not blank

Setup A SharePoint List With Member Details
The Copilot will search for a member in the database using the given entity type. To do this, we will need to create a table and populate it with data.
Open SharePoint and create a new list named Fitness Club Members with the following columns:
- Member ID (text)
- Member Name (text)
- Member Email (text)
- Membership Level (text)
- Renewal Date (date only)

Load this data into the SharePoint list:
Member ID | Member Name | Member Email | Membership Level | Renewal Date |
350856 | John Smith | [email protected] | Gold | 8/15/2025 |
350857 | Emily Haynes | [email protected] | Silver | 11/3/2025 |
350858 | Michael Brown | [email protected] | Platinum | 2/20/2026 |
350859 | Jessica Johnson | [email protected] | Bronze | 5/10/2026 |
350860 | Matthew Davis | [email protected] | Silver | 7/25/2025 |
350861 | Sarah Wilson | [email protected] | Gold | 9/30/2025 |
350862 | David Martinez | [email protected] | Bronze | 12/18/2025 |
350863 | Linda Anderson | [email protected] | Silver | 3/5/2026 |
350864 | James Taylor | [email protected] | Platinum | 6/20/2026 |
350865 | Elizabeth Thomas | [email protected] | Gold | 10/12/2025 |
Get Items From The SharePoint List Using The Lookup Value
Each branch of the add a condition tree will use a different query to get items from SharePoint. Go to the Person Name is not blank condition and add a SharePoint – Get Items action.

Use this formula in the Filter Query property and set the Top Count to 1.
$"MemberName eq '{Topic.value.'Person name'}'"
Similarly, in the Email is not Blank condition add a Get Items action.

Then fill-in the Filter Query with this formula and change the Top Count to 1.
$"MemberEmail eq '{Topic.value.Email}'"
Finally, add one more Get Items action to the Membership Number is not blank condition.

And write this formula in the Filter Query field while setting the Top Count to 1.
$"MemberID eq '{Topic.value.'Membership Number'}'"
End The Current Topic Inside The Else Condition
If the User fails to enter a member name, email or membership number the else condition will be triggered. We want to end the topic when this happens because no search can be performed.
Add a message node in the all other conditions branch matching the text below. The end the current topic.

Display Membership Details To The User
No matter which path in the topic is followed, each branch will output a variable named GetItems with exactly the same structure. However, GetItems returns items in array type property named value. We want to convert the single-item in the array to a record type variable so we can send its details to the User in a message.
After the end of the conditional branching, add a set variable value node to the topic. Name the variable memberRecord.

Use this code to extract the single-item from the value array in GetItems and store it as a record type.
First(Topic.GetItems.value)
Then create a message node to display the membership details to the User.

Use this text in the message node:
Here’s the member record: • ID: {memberRecord.MemberID} • Name {memberRecord.MemberName} • Email: {memberRecord.MemberEmail} • Membership Level: {memberRecord.MembershipLevel} • Renewal Date: {memberRecord.RenewalDate} |
Redirect The Agent On Conversation Start
It will be quicker to test the Agent if we immediately redirect to the User to the topic at the start of the conversation. Go to the Topics tab and open the Conversation Start system topic.

Add a redirect node to the Look Up Membership Account topic.

Test The Copilot Studio Agent With Multiple Entity Types
We’re done. Test the Agent with a value for multiple entity types to ensure it is working as planned.

Did You Enjoy This Article? 😺
Subscribe to get new Power Apps & Power Automate articles sent to your inbox each week for FREE
Questions?
If you have any questions or feedback about Copilot Studio: Detect Multiple Entity Types In A Question 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.