title: How to rebuild chat bot dialog using bot framework
body: <p>I am working on a multi dialog form flow chat bot using bot framework.</p>
  
  <p>Below is one of my dialog code where I want to get the confirmation from the user and if necessary, needs to alter customer selection/ parameters provided.</p>
  
  <p>below is the code I'm working on </p>
  
  <p><strong>Dialog</strong> </p>
  
  <pre><code>    namespace FormBot.Dialogs
  {
  
      [Serializable]
      public class HardwareDialog : IDialog&lt;object&gt;
      {
          public async Task StartAsync(IDialogContext context)
          {
              await context.PostAsync("Welcome to the Hardware solution helpdesk!");
              var HardwareFormDialog = FormDialog.FromForm(this.BuildHardwareForm, FormOptions.PromptInStart);
              context.Call(HardwareFormDialog, this.ResumeAfterHardwareFormDialog);
          }
  
          private IForm&lt;HardwareQuery&gt; BuildHardwareForm()
          {
              OnCompletionAsyncDelegate&lt;HardwareQuery&gt; HardwareRequest = async (context, state) =&gt;
              {
                  string message = string.Empty;            
                  await context.PostAsync($"Ok. {message}.  Once we resolve it; we will get back to you....");
              };
  
              return new FormBuilder&lt;HardwareQuery&gt;()
                  .Field(nameof(HardwareQuery.Hardware))
                  .Message($"We are Creating Ticket your request ...")
                  .AddRemainingFields()
                  .OnCompletion(HardwareRequest)
                  .Build();
          }
  
          private async Task ResumeAfterHardwareFormDialog(IDialogContext context, IAwaitable&lt;HardwareQuery&gt; result)
          {
              try
              {
  
              }
              catch (FormCanceledException ex)
              {
                  string reply;
  
                  if (ex.InnerException == null)
                  {
                      reply = "You have canceled the operation. Quitting from the HardwareDialog";
                  }
                  else
                  {
                      reply = $"Oops! Something went wrong :( Technical Details: {ex.InnerException.Message}";
                  }
  
                  await context.PostAsync(reply);
              }
              finally
              {
                  context.Done&lt;object&gt;(null);
              }
          }
  
          public static IForm&lt;HardwareDialog&gt; BuildForm()
          {
              return new FormBuilder&lt;HardwareDialog&gt;()
                      .Message("Welcome to Service Ticket Bot!")
                      .Build();
          }
  
  
      }
  }
  </code></pre>
  
  <p><strong>Query builder</strong> </p>
  
  <pre><code>public enum HardwareOptions
      {
          Desktop, KeyBoard, Laptop, Monitor, Mouse, Printer, Scanner, Server, Tablet
      };
  
      [Serializable]
      public class HardwareQuery
      {
  
          [Prompt("Choose your {&amp;} ? {||}")]
          public HardwareOptions? Hardware;
  
          [Prompt("Please enter {&amp;}")]
          [Pattern(Utility.Phone)]
          public string PhoneNumber { get; set; }
  
  
          [Prompt("Please enter {&amp;} ")]
          [Pattern(Utility.Email)]
          public string Email { get; set; }
  
          [Prompt("Please provide your business need / {&amp;} below")]
          public string Justification { get; set; }
  
          public static IForm&lt;HardwareQuery&gt; BuildForm()
          {
              OnCompletionAsyncDelegate&lt;ServiceTicket&gt; processOrder = async (context, state) =&gt;
              {
                  await context.PostAsync($"Once we resolve it; we will get back to you....");
              };
  
              return new FormBuilder&lt;HardwareQuery&gt;()
                      .Message("Welcome !")
                      .Build();
          }
      }
  }
  </code></pre>
  
  <h2>Expected result</h2>
  
  <p><a href="https://i.stack.imgur.com/oscHY.png" rel="nofollow noreferrer">Asking for confirmation</a>
  <a href="https://i.stack.imgur.com/IfOp4.png" rel="nofollow noreferrer">Updating the result set</a></p>