Display a multi-select options list in Copilot Studio
Note
This article applies to classic chatbots only. To extend copilots created in Copilot Studio, you don't need to use Bot Framework Composer. All features described in this article are available for copilots, directly in Copilot Studio.
Enhance your bot by developing custom dialogs with Bot Framework Composer and then adding them to your Microsoft Copilot Studio bot.
In this example, you'll learn how to display a multi-select list in Microsoft Copilot Studio by using Composer.
Important
Composer integration isn't available to users who only have the Teams Microsoft Copilot Studio license. You must have a trial or full Microsoft Copilot Studio license.
Prerequisites
Create a new dialog
In Copilot Studio, open the bot you created in Example 1. If you haven't completed Example 1 yet, see Show an Adaptive Card in Copilot Studio.
Open your bot in Composer. For instructions on how to do so, see Get started with Bot Framework Composer.
In Composer, go to the Create page. In your bot, select More options (...) then select + Add a dialog. For Name enter
DailySpecials
.In your new DailySpecials dialog, select the BeginDialog trigger to open the authoring canvas.
On the authoring canvas, select Add (+), Manage properties, and Set a property.
In the properties pane:
For Property, enter
conversation.days_array
.For Value, change the type to [] array.
For Value, copy and paste the following array
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
Configure bot responses
Go to the Bot Responses page, select DailySpecials, then select Show code.
Copy and paste the following template into the code view to create daily offers for all the days of the week.
# DailySpecials(day) - SWITCH: ${day} - CASE: ${0} - All tofu meals are 10% off on Sundays! - Every Sunday, all tofu entrees are 10% off. - CASE: ${1} - All steak options are 10% off on Mondays! - Enjoy your Monday with a special offer of 10% off on all steak dishes! - CASE: ${2} - All the chicken meal options are 10% off on Tuesdays! - Tuesday special is 10% off on all the chicken dishes! - CASE: ${3} - All the chicken and tofu meal options are 10% off on Wednesdays! - Wednesday special is 10% off on all the chicken and tofu dishes! - CASE: ${4} - On Thursdays, get a free delivery in Seattle, Bellevue, and Redmond on all orders over $80! - Thursday special is a free delivery on orders over $80 in Seattle, Bellevue, and Redmond. - CASE: ${5} - Friday special - get a 10% discount on all dishes and delivery is free on all orders over $80! - Every Friday, we offer 10% off on all meals and a free delivery on orders over $80! - CASE: ${6} - On Saturdays, we have a free delivery on all orders over $50. - Free delivery on all orders over $50 on Saturdays! - DEFAULT: - Holiday special - free delivery anywhere in Seattle, Bellevue and Redmond on orders over $70 today! - Holiday Delivery is on us if you are in Seattle, Bellevue and Redmond and your order is over $70 total!
Prompt for user input
Go to the Create page. In the bot explorer, under DailySpecials, select BeginDialog.
On the authoring canvas, select Add (+), Ask a question, and Multi-choice.
Select the User Input (Choice) action. In the properties pane, under Responses, enter
Please select a day:
Select the User Input page in the properties pane, then do the following:
For Property, enter
conversation.day_choice
.For Output format, choose index to return the index of the selected option instead of a value.
For List style, choose heroCard to display our options list vertically.
For Array of choices, change the type to Write an expression.
For Array of choices, enter
=conversation.days_array
.
Display daily special
On the authoring canvas, select Add (+) then Send a response.
In the properties pane, under Bot responses, and select Show code. Copy and paste the following expression:
- ${DailySpecials(conversation.day_choice)}
In the bot explorer, go to the main dialog. Select More options (...) then select Add new trigger.
In the Create a trigger window, do the following:
For What is the type of this trigger?, select Intent recognized.
For What is the name of this trigger?, enter
Specials
.For Trigger phrases, copy and paste the following:
-what specials do you have -any special deals -do you have discounts
Select Submit.
In the bot explorer, select the Specials trigger.
On the authoring canvas, select Add (+), Dialog management, then Begin a new dialog or topic.
In the properties pane, for Dialog name, select DailySpecials
Test your bot
Publish your Composer content to make it available in your Microsoft Copilot Studio bot.
Important
Selecting Publish in Composer makes the changes available for testing, but doesn't automatically publish your bot.
Publish your bot in Microsoft Copilot Studio to update your bot across all the channels it's connected to.
Go to the Microsoft Copilot Studio Topics page to see your new Specials and DailySpecials topics.
Open the Test bot pane and make sure Track between topics is turned on. Enter the message
Do you have any specials?
to start your conversation.