Articles → MICROSOFT BOT FRAMEWORK → Confirm Dialog In Microsoft Bot Framework

Confirm Dialog In Microsoft Bot Framework






Example






using Microsoft.Bot.Builder.FormFlow;
using System;

namespace Bot_Application1.Dialogs { [Serializable]
  public class FormFlowDemo {
    public string Name;
    public string MobileNumber;
    public string city;
    public static IForm < FormFlowDemo > GetForm() {
      return new FormBuilder < FormFlowDemo > ().Message("Welcome to support chat system. Please place your order").Field(nameof(city)).Confirm(async(state) =>{
        double minOrder = 0;
        switch (state.city) {
        case "delhi":
          minOrder = 100;
          break;
        case "gurugram":
          minOrder = 150;
          break;
        case "noida":
          minOrder = 250;
          break;
        }
        return new PromptAttribute($ "For {state.city}, the minimum order is {minOrder}. Please confirm.");
      }).Field(nameof(MobileNumber)).Field(nameof(Name)).Confirm("Thank you {Name}. Your order is placed. We will deliver your order to {city} in approx. 1 hour").Build();
    }
  }
}



Output


Picture showing the confirmation message where bot is asking for the minimum order from the user
Click to Enlarge



Picture showing the final confirmation message once the order is placed
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, October 23, 2020

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250