简体   繁体   中英

Botframework Formflow not binding LUIS builtin.number to int or int? field

I have an issue where even though there is an entity in the message, the formflow still prompts me to enter the ticket number. I have declared the TicketNumber as int here. I have also tried declaring TicketNumber as int?

I tried variation 2 where passed in the number. But even then it asks me for ticketnumber showing 12345 as the current choice when prompting. Could the null Score as we see in the watch below be a problem? I have other bigger form with multiple string fields and it is working fine.

Variation 1:

var ticketStatusParametersForm = new FormDialog<TicketStatusParameters>(new TicketStatusParameters(), this.MakeTicketStatusParametersForm, FormOptions.PromptInStart, result.Entities);

Variation 2:

var ticketNumber = 12345;
var ticketStatusParametersForm = new FormDialog<TicketStatusParameters>(new TicketStatusParameters { TicketNumber = ticketNumber}, this.MakeTicketStatusParametersForm, FormOptions.PromptInStart, result.Entities);

public class TicketStatusParameters
    {
       [Prompt("Please enter a ticket number {||}")]
       [Describe("Ticket Number")]
       [Template(TemplateUsage.NotUnderstood, "Please enter a valid ticket number. I did not understand \"{0}\"")]
       public int TicketNumber { get; set; }
   }

The automatic binding doesn't work with Prebuilt entities as FormFlow uses the EntityRecommendation.Type value to look for a field with the same name in your Form model. You need to use the Variation #2.

在此处输入图片说明

Regarding the problem described in Variation #2, I think the issue is that your prompt has the {||} pattern element, which doesn't make sense for not enumerable fields.

Try using just [Prompt("Please enter a ticket number")]

I have test code which has a nullable field and when that field is passed in as part of the state that field is skipped. Unless you are passing in FormOptions.PromptFieldsWithValues, I don't see how you are getting this behavior. You changed your class to this, right?

public class TicketStatusParameters
    {
       [Prompt("Please enter a ticket number {||}")]
       [Describe("Ticket Number")]
       [Template(TemplateUsage.NotUnderstood, "Please enter a valid ticket number. I did not understand \"{0}\"")]
       public int? TicketNumber { get; set; }
   }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM