Reputation: 43
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!
Upvotes: 1
Views: 1383
Reputation: 31
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
}
Upvotes: 3
Reputation: 14787
You are using the wrong attribute. Instead of using the Prompt
attribute, you need to use the Describe
one.
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
}
Upvotes: 6