Note on how to dynamically retrieve question choices from a SharePoint list in Copilot Studio.
What we want to do
Created in a previous post, the question “Leave Types” within the topic “Leave Requests”,
dynamically retrieved from the SharePoint list.
*Previous article here
Copilot Studio基礎 エンティティとスロット充填(スロット埋込み)|会話内の情報の「型定義」と「抽出」
Copilot Studioの「エンティティ」と「スロット充填(スロット埋込み)」について調べたのでメモ。※この記事のサンプルで紹介するベースのエージェントのつくり方はこちらエンティティエンティティは「型定義」に似ていて、「電話番号」とか「...
Construction
First, create a connection to SharePoint. Under “Call Actions,” from “Connectors,” choose “Get Multiple Items”.
connect to SharePoint.
Pick a site and list that defines the type of vacation,
*We can select a site or list by pressing inside the text box, not the [>]button.
Put the vacation type table obtained from the SharePoint list into a variable (vacationTypes).
Then change the “Question” node’s [Specific] to [List Variable Options],
set the list variable to the value retrieved from SharePoint earlier.
However, if the variable is set as is, an error will occur if the “DisplayName” property does not exist,
However, if the variable is set as is, an error will occur if the “DisplayName” property does not exist,
Use the AddColumns function to add the DisplayName property.
*ForAll is also fine, as described below.
*ForAll is also fine, as described below.
Finally, assign the value selected by the user to the variable (type),
use that value (this time simply to send out a message).
This completes the topic.
Operation check
When we start a topic, you will be asked to make a connection,
so create the connection,
and start the topic again to see the SPO list options.
When the user selects a vacation type, the variable is assigned the contents of the list item.
When you add a new vacation type to the list,
reflected in the question.
So it was very easy to work with the SPO list.
Extra: List variables can also be string arrays.
The values to be set in the list variable can be a string array, so the ForAll function can be used to set an array of just the column “title”.
Then, the variable to which the user’s selected value is assigned becomes a “string” type,
Then, the variable to which the user’s selected value is assigned becomes a “string” type,
and can be used as is because it is a string.
ForAll is easier if you don’t need ID columns and such and don’t need to get them as objects.