Ian Boggs
Ian Boggs

Reputation: 522

Starting a FormFlow Dialog From Another Dialog

I have bot consisting of a main LuisDialog and two other dialogs. When I get a certain LuisIntent I start one of the other dialogs (which is the sample Echo Bot) and when I end that dialog it returns to the main LuisDialog no problem.

When I get the LuisIntent to start the other dialog, which is a FormFlow dialog, it does happyily start the dialog, but the user has to enter something before the dialog runs. So the user enters 'order a sandwich' and then has to enter anything else before getting the first message in the dialog.

Does anyone know who to start a FormFlow, or indeed any, Dialog and jump straight into it without waiting for the user to enter anything? The code I'm using to start the sandwich dialog is as follows:

    internal static IFormDialog<SandwichBot.SandwichOrder> MakeRootDialog()
    {


        return FormDialog.FromForm(SandwichBot.SandwichOrder.BuildForm);
    }

    [LuisIntent("OrderSandwich")]
    public async Task StartSandwichOrder(IDialogContext context, LuisResult result)
    {
        IFormDialog<SandwichBot.SandwichOrder> tmp = MakeRootDialog();
        context.Call(tmp, SandwichOrderComplete);
    }

Upvotes: 3

Views: 1383

Answers (1)

Ian Boggs
Ian Boggs

Reputation: 522

Ok, sorted. I missed the FormOptions when making the form. So, MakeRootDialog should have been

        internal static IFormDialog<SandwichBot.SandwichOrder> MakeRootDialog()
    {
        return FormDialog.FromForm(SandwichBot.SandwichOrder.BuildForm,options: FormOptions.PromptInStart);
    }

Upvotes: 3

Related Questions