cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sarah_Bull
Advocate I
Advocate I

How to populate options in "Post a choice of options as the Flow bot to a user"

I am using the action "Post a choice of options as the Flow bot to a user". I want the choices to dynamically populate from a text string array, so that if the array is ["Dog", "Cat", "Fish"], then the user will see the Flow bot ask them to choose one of "Dog", "Cat", or "Fish".

 

Here is a screenshot:

Screen Shot 2019-07-14 at 9.44.03 am.png

The PeekCode is:

"UserMessageWithOptionsSubscriptionRequest/body/options": [
"@variables('ArrayInitial')"
],
 
This interprets the array as a single text string, instead of multiple options. That means that the Flow Bot is posting one single option of "Dog, Cat, Fish", instead of different choices.
 
When I try putting in the array without brackets, I get this error: "OpenApiOperationParameterValidationFailed. The 'inputs.parameters' of workflow operation 'Post_a_choice_of_options_as_the_Flow_bot_to_a_user_2' of type 'OpenApiConnectionWebhook' is not valid. Error details: The API operation does not contain a definition for parameter 'UserMessageWithOptionsSubscriptionRequest/body/options'."
 
How can I get the Flow Bot to correctly grab the list of options from an array?
 
Thank you for your help!
1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

Hi @Sarah_Bull ,

 

Could you provide screenshoot of Flow configuration?

I did a test on my side and can configure the array directly in Options.

Add mutiple-select list of options to Button and create an array based on the user's choice.

2.PNG

Configure the array in Options field, and the options selected by the user will be displayed in the message.

3.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
RobElliott
Super User
Super User

Hi Sarah @Sarah_Bull , it will always only see the output of the array as a single option because you've only populated 1 option field. You would need to have 3 string variables and then use the output of each variable as an option. I've just manually populated the variables with Dog, Cat and Fish, whereas depending on what other actions you have you might initialize the variables with a blank value then use the action "Append to string variable" to set the value. If you post up the rest of your Flow we could advise on that, but for now my Flow and the result is shown below.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

1-Flow.png2-ResultinTeams.png

Thanks, @RobElliott, that's helpful. What I want to automate is a dynamic length, however, so I want the number of options to vary per run.

 

The workflow is:

  1. Get the options from a spreadsheet (number of options varies per Flow run)
  2. Post the options to the user
  3. User selects an option
  4. The selected option is then processed

I could use a condition to account for each possible number of options, but that seems inelegant.

If the number of options will vary on each occasion then I think you will need to consider using parallel branching or switch cases as you can't initialize a variable on the fly. What is the maximum number of options that you will wish to present to your users?

Rob
Los Gallardos

v-bacao-msft
Community Support
Community Support

Hi @Sarah_Bull ,

 

Could you provide screenshoot of Flow configuration?

I did a test on my side and can configure the array directly in Options.

Add mutiple-select list of options to Button and create an array based on the user's choice.

2.PNG

Configure the array in Options field, and the options selected by the user will be displayed in the message.

3.PNG

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thanks, Barry!

 

Could you show me your 'Peek Code' for the options population? I am finding that your method sometimes works and sometimes it doesn't, and I'm having a hard time understanding why this occurs in different circumstances.

With this problem I have also bitten my teeth out, but the solution is - as mostly - quite simple.
Here is what worked for me:

Step 1: Trigger definition and adding the Post a choice of options as the Flow bot to a user action.

image.png

Step 2: Click on the highlighted button to switch gears.

(If Options Item - 1 (the initial state) is shown, you cannot add an array to the field).

image.png

Now Options is shown and you can add an array to the field.

That's it. Hope it helps.

 

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,016)