1

I am working with MS bot framework and I can't find way to custom message for enum options in form flow. I have tried with prompt attribute but it doesn't work.

What I want is: bot will show options for user like:

1) Yes, I want to be a DayNinja!

2) No, I don't want to unlock flow to achieve my goals.

3) Later, I'll start with the basics

Now, All I get are: "Yes", "No", "Later"

Any help will be appreciated Thank you!

My code

Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43

2 Answers2

6

You are using the wrong attribute. Instead of using the Prompt attribute, you need to use the Describe one.

enter image description here

public enum OpeningHubOptions
{
    [Describe("Yes, I want to be a DayNinja")]
    Yes = 1,

    [Describe("No, I don't want to unlock flow to achieve my goals.")]
    No = 2,

    [Describe("Later, I''ll start with the basics")]
    Later = 3
}
Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43
3

What Ezequiel posted did not work with me, because whenever you clicked on the menu item, the Describe value was posted instead. This resulted in the bot not being happy as the value was not part of the variable options.

I resolved this by replacing Describe with Display followed by including System.ComponentModel.DataAnnotations. More information:- How to set space on Enum.

For example:

using System.ComponentModel.DataAnnotations;    
public enum OpeningHubOptions
    {
        [Display(Name = "Yes, I want to be a DayNinja")]
        Yes = 1,

        [Display(Name = "No, I don't want to unlock flow to achieve my goals.")]
        No = 2,

        [Display(Name = "Later, I''ll start with the basics")]
        Later = 3
    }
g00glen00b
  • 41,995
  • 13
  • 95
  • 133
Sam EA
  • 31
  • 3