Hi @HenryJammes
and everyone, Hope you all doing well.
I am trying to use list variable in ask a Question for dynamically access the variable data as prompt question .
i am unable to create list variable as i want to show max of 4 Question prompt , The question will come from power automation in json right now i am try to get the belwo schema but it giving me error that expected StringDatatype .
power automation Schema:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"DisplayName": {
"type": "string"
},
"question": {
"type": "string"
},
"id": {
"type": "integer"
}
},
"required": [
"DisplayName",
"question",
"id"
]
}
}
Hi @HenryJammes , Hope you doing well.
I have created Fallback Flow in PVA and it show followup question with each response but the problem is if
i donot select any option and send new text as a message the Fallback flow trigger didnot activate but instead it give me the previous response followup questions .
here is the asked question kindly slove this , i have put all code and every thing , it must trigger the event with out selecting the options which is given by list of variable in ask a Question topic.
These are good signals for us to publish more "how to" articles.
We'll very likely publish them here: aka.ms/CopilotStudioGuidance
From an architecture standpoint, I recommend: aka.ms/CopilotStudioImplementationGuide
Thanks alot @HenryJammes you saved me.
I jsut edit schema in Parse value and put you code and it worked
Thanks once again.
Also kindly tell me the best resources to learn, for using Bot Framework SDK as currently we are facing time out issues in Power Automation so in future we will use that with PVA.
In your parse value node, have you tried "From sample data"?
In the JSON you shared, this is the schema you should use for the Record type:
kind: Record
properties:
json:
type:
kind: Table
properties:
DisplayName: String
id: Number
question: String
Then you'll be able to display the .json table as part of your record variable.
Hi @HenryJammes
Thanks but little issue on my side which is as under:
when i receive json string from Power Automate then i use parse_value and save this JSON as record datatype in OptionsTable variable .
then i print both variable the first JSON string and after parse value OptionsTable but the OptionsTable has empty {} showing on PVA side and Json string look like this.
This is payload coming from Power Automation:
JSON string:
{“json”:[{“DisplayName”:“What is your favorite color?”,“question”:“What is your favorite color?”,“id”:1},{“DisplayName”:“How did you discover our services?”,“question”:“How did you discover our services?”,“id”:2},{“DisplayName”:“Tell us about your experience with our products.”,“question”:“Tell us about your experience with our products.”,“id”:3}]}
OptionsTable record:
{}
and OptionsTable is not show print data.
but when i set list variable in Question then i select Topic.OptionsTable because json is not available after dot.
here is image of error showing DisplayName is missing:
Error:
The expression on the ‘DynamicClosedListEntityReference’ node at ‘cr52e_goodbye.topic.Goodbye/main/main/question_WxDymK’ failed because it returned ‘Record()’ when ‘RuntimeType’ was expected. Error code: ContentValidationError. Conversation ID: 8ef3c1cc-83f2-4ee2-9683-05f5fdbc41d9. Time (UTC): 1/11/2024 1:36:57 PM.
code here:
kind: AdaptiveDialog
beginDialog:
kind: OnRecognizedIntent
id: main
intent:
displayName: Greeting
includeInOnSelectIntent: false
triggerQueries:
- Good afternoon
- Good morning
- Hello
- Hey
- Hi
actions:
- kind: SendActivity
id: sendActivity_J3cp22
activity: Hi , how are you
- kind: Question
id: question_obehfP
interruptionPolicy:
allowInterruption: true
variable: init:Topic.UserCity
prompt: Please write your favourite City Name
entity: CityPrebuiltEntity
- kind: InvokeFlowAction
id: invokeFlowAction_vEQcL0
input:
binding:
text: =Topic.UserCity
output:
binding:
list_of accounts options: Topic.ListOfAccountsOptions
number_of accounts: Topic.NumberofAccounts
flowId: 7c0ebdec-76b0-ee11-a569-6045bd006ade
- kind: ParseValue
id: 7lUl56
variable: Topic.table
valueType:
kind: Table
value: =Topic.ListOfAccountsOptions
- kind: SendActivity
id: sendActivity_qoLkim
activity: |-
The following are the data coming from Power automate:
- **ListOfAccountsOtions data in PVA**
1. {Topic.ListOfAccountsOptions}
- **NumberofAccounts data in PVA**
1. {Topic.NumberofAccounts}
- kind: ConditionGroup
id: conditionGroup_5PX1Rh
conditions:
- id: conditionItem_ybiWsE
condition: =Topic.NumberofAccounts = """0"""
elseActions:
- kind: SendActivity
id: sendActivity_dytGRy
activity: Ok i have found some question for you.
- kind: Question
id: question_st4CEA
interruptionPolicy:
allowInterruption: true
variable: init:Topic.selectedQuestion
prompt:
entity:
kind: DynamicClosedListEntity
items: |-
=ForAll(
Table(ParseJSON(Topic.ListOfAccountsOptions)),
Text(ThisRecord.Value)
)
- kind: SendActivity
id: sendActivity_EwJOrq
activity: wow you has selected the above question it mena promt is working
- kind: CancelAllDialogs
id: cancelAllDialogs_01At22
2: I have also implemented you tutorial from this link but some issues on question Topic.
PVA unified authoring canvas to display dynamic choice options
https://powerusers.microsoft.com/t5/General/How-can-I-use-Dynamic-Multi-choices-in-the-PVA-chatbot/m-p/1928423
in this flow i get this ListOfAccountOption data as string from Power Automation.
Incomming data printed in PVA
but i also getting error like this:
The expression on the ‘DynamicClosedListEntityReference’ node at ‘cr52e_goodbye.topic.Greeting/main/main/conditionGroup_5PX1Rh/conditionGroup_5PX1RhElseActions/question_7AqFQo’ failed with the following errors: ‘The untyped object argument to the ‘Text’ function has an incorrect type. Expected: Text, Actual: Microsoft.PowerFx.Types.ExternalType.’ (Text(ThisRecord.Value)),
‘The untyped object argument to the ‘Text’ function has an incorrect type. Expected: Text, Actual: Microsoft.PowerFx.Types.ExternalType.’ (Text(ThisRecord.Value)),
‘The untyped object argument to the ‘Text’ function has an incorrect type. Expected: Text, Actual: Microsoft.PowerFx.Types.ExternalType.’ (Text(ThisRecord.Value)). Error code: ContentValidationError. Conversation ID: e8a2c8c6-711a-46e3-81f5-40e6c89e3f0c. Time (UTC): 1/11/2024 1:41:03 PM.
the following are data which i have print in message:
The following are the data coming from Power automate:
ListOfAccountsOtions data in PVA
[{“DisplayName”:“What is your favorite color?”,“question”:“What is your favorite color?”,“id”:1},{“DisplayName”:“How did you discover our services?”,“question”:“How did you discover our services?”,“id”:2},{“DisplayName”:“Tell us about your experience with our products.”,“question”:“Tell us about your experience with our products.”,“id”:3}]
NumberofAccounts data in PVA
1
Here is code:
kind: AdaptiveDialog
beginDialog:
kind: OnRecognizedIntent
id: main
intent:
displayName: Greeting
includeInOnSelectIntent: false
triggerQueries:
- Good afternoon
- Good morning
- Hello
- Hey
- Hi
actions:
- kind: SendActivity
id: sendActivity_J3cp22
activity: Hi , how are you
- kind: Question
id: question_obehfP
interruptionPolicy:
allowInterruption: true
variable: init:Topic.UserCity
prompt: Please write your favourite City Name
entity: CityPrebuiltEntity
- kind: InvokeFlowAction
id: invokeFlowAction_vEQcL0
input:
binding:
text: =Topic.UserCity
output:
binding:
list_of accounts options: Topic.ListOfAccountsOptions
number_of accounts: Topic.NumberofAccounts
flowId: 7c0ebdec-76b0-ee11-a569-6045bd006ade
- kind: ParseValue
id: 7lUl56
variable: Topic.table
valueType:
kind: Table
value: =Topic.ListOfAccountsOptions
- kind: SendActivity
id: sendActivity_qoLkim
activity: |-
The following are the data coming from Power automate:
- **ListOfAccountsOtions data in PVA**
1. {Topic.ListOfAccountsOptions}
- **NumberofAccounts data in PVA**
1. {Topic.NumberofAccounts}
- kind: ConditionGroup
id: conditionGroup_5PX1Rh
conditions:
- id: conditionItem_ybiWsE
condition: =Topic.NumberofAccounts = """0"""
elseActions:
- kind: SendActivity
id: sendActivity_dytGRy
activity: Ok i have found some question for you.
- kind: Question
id: question_st4CEA
interruptionPolicy:
allowInterruption: true
variable: init:Topic.selectedQuestion
prompt:
entity:
kind: DynamicClosedListEntity
items: |-
=ForAll(
Table(ParseJSON(Topic.ListOfAccountsOptions)),
Text(ThisRecord.Value)
)
- kind: SendActivity
id: sendActivity_EwJOrq
activity: wow you has selected the above question it mena promt is working
- kind: CancelAllDialogs
id: cancelAllDialogs_01At22
I am realy stuck from last 3 days, Please
Hi @Maxmellien
I got it to work like this: you can see that the selected option is the full record option with all its properties.
One important thing to notice with your JSON schema is that your table is within a record (under the json property).
I mocked up your returned JSON string that Power Automate returns as a variable, and then use a Parse Value and then reference the Topic.OptionsTable.json to reference the table and not the record.
Here's my example topic:
kind: AdaptiveDialog
beginDialog:
kind: OnRecognizedIntent
id: main
intent:
triggerQueries:
- Dynamic Options Maxmellien
actions:
- kind: SetVariable
id: setVariable_LDnSSa
variable: Topic.JSON
value: "{ \"json\": [ { \"DisplayName\": \"What is your favorite color?\", \"question\": \"What is your favorite color?\", \"id\": 1 }, { \"DisplayName\": \"How did you discover our services?\", \"question\": \"How did you discover our services?\", \"id\": 2 }, { \"DisplayName\": \"Tell us about your experience with our products.\", \"question\": \"Tell us about your experience with our products.\", \"id\": 3 } ] }"
- kind: ParseValue
id: z5uaRt
variable: Topic.OptionsTable
valueType:
kind: Record
properties:
json:
type:
kind: Table
properties:
DisplayName: String
id: Number
question: String
value: =Topic.JSON
- kind: Question
id: question_wJmTcv
interruptionPolicy:
allowInterruption: true
variable: init:Topic.SelectedOption
prompt: Please select an option
entity:
kind: DynamicClosedListEntity
items: =Topic.OptionsTable.json
Note: I'm not sure you need to do a ParseJSON on the Power Automate side, since you also do a Parse Value on the Copilot Studio side. Returning the output body of your HTTP request directly to Copilot Studio may simplify your implementation. If that makes sense, you can also make the HTTP request directly in Copilot Studio.
Henry
Hi @HenryJammes ,
Thanks for quick response.
here is my payload that will come to http action in Power automate:
output body:
[
{
"DisplayName": "What is your favorite color?",
"question": "What is your favorite color?",
"id": 1
},
{
"DisplayName": "How did you discover our services?",
"question": "How did you discover our services?",
"id": 2
},
{
"DisplayName": "Tell us about your experience with our products.",
"question": "Tell us about your experience with our products.",
"id": 3
}
]
After that i use ParseJson and this action output is:
Input Schema:
{
"type": "array",
"items": {
"type": "object",
"properties": {
"DisplayName": {
"type": "string"
},
"question": {
"type": "string"
},
"id": {
"type": "integer"
}
},
"required": [
"DisplayName",
"question",
"id"
]
}
}
Output body:
[
{
"DisplayName": "What is your favorite color?",
"question": "What is your favorite color?",
"id": 1
},
{
"DisplayName": "How did you discover our services?",
"question": "How did you discover our services?",
"id": 2
},
{
"DisplayName": "Tell us about your experience with our products.",
"question": "Tell us about your experience with our products.",
"id": 3
}
]
After this return value to PVA:
input Schema:
{
"type": "object",
"properties": {
"json": {
"title": "JSON",
"type": "string",
"x-ms-content-hint": "TEXT",
"x-ms-dynamically-added": true
}
},
"additionalProperties": {}
}
input body:
{
"json": [
{
"DisplayName": "What is your favorite color?",
"question": "What is your favorite color?",
"id": 1
},
{
"DisplayName": "How did you discover our services?",
"question": "How did you discover our services?",
"id": 2
},
{
"DisplayName": "Tell us about your experience with our products.",
"question": "Tell us about your experience with our products.",
"id": 3
}
]
}
Here is Flow images:
Below is my PVA FLOW:
I got this error from PA in PVA action:
Bot said:
Error Message: The parameter with name ‘json’ on flow ‘Get JSON Data from FastAPI’ (‘ba806a9a-c1af-ee11-a569-6045bd006ade’) evaluated to type ‘TableDataType’ , expected type ‘StringDataType’ Error Code: FlowActionBadRequest Conversation Id: 32216d81-9419-41e5-9c76-d3f86b9a08e5 Time (UTC): 2024-01-11T07:42:55.408Z
here is image:
What should be the structure so my flow give me no error and question Topic ask these question prompt?
I want to prompt my question like this:
here is my PVA flow code:
kind: AdaptiveDialog
beginDialog:
kind: OnRecognizedIntent
id: main
intent:
displayName: Greeting
includeInOnSelectIntent: false
triggerQueries:
- Good afternoon
- Good morning
- Hello
- Hey
- Hi
actions:
- kind: InvokeFlowAction
id: invokeFlowAction_yXlaZe
input: {}
output:
binding:
json: Topic.Json
flowId: ba806a9a-c1af-ee11-a569-6045bd006ade
- kind: ParseValue
id: 5Hl6ux
variable: Topic.tableVariable
valueType:
kind: Table
value: =Topic.Json
- kind: SendActivity
id: sendActivity_YEjvvS
activity: "{Topic.Json}"
- kind: Question
id: question_BfQkGo
interruptionPolicy:
allowInterruption: true
variable: init:Topic.Var1
prompt:
entity:
kind: DynamicClosedListEntity
items: =Topic.tableVariable
- kind: CancelAllDialogs
id: cancelAllDialogs_01At22
Thanks
Hi @Maxmellien
Can you share a sample payload that Power Automate returns and that you want to use Copilot Studio as options for a question?
Henry
Michael E. Gernaey
169
Super User 2025 Season 2
Romain The Low-Code...
150
sandeep_angara
75
Super User 2025 Season 2