Reprompt / Go back / Go to specific step in waterfall dialog









up vote
-1
down vote

favorite












Botbuilder 4.1.1
Classic task: we have waterfall dialog, in ctor i'm defining waterfall describing all steps:



var authenticate = new WaterfallStep

AskForPhone,
FinishOnboardingDialog,
AskWhatToDo,
AskTicketInfo
;

AddDialog(new WaterfallDialog(InitialDialogId, authenticate));
AddDialog(new TextPrompt("phonePrompt", CustomPromptValidatorAsync));
AddDialog(new ChoicePrompt("optionsDialog"));
AddDialog(new TextPrompt("askTicketInfo"));


...
then on one step i'm asking a prompt:



 public async Task<DialogTurnResult> FinishOnboardingDialog(WaterfallStepContext sc, CancellationToken cancellationToken)

_state = await _accessor.GetAsync(sc.Context);

return await sc.PromptAsync("optionsDialog", new PromptOptions()


Choices = new List<Choice>()


new Choice("Create a ticket"),
new Choice("Contact your advisor organization"),
new Choice("Contact AgriSync"),
new Choice("List bot commands"),
,

, cancellationToken);



Then on next step i'm checking the response.



On some of options i want just to collect info and go further. But on some option i would like to reprompt last question or go to some specific step of dialog.
In botbuilder v3 dialogs worked by old style callbacks, so every step was just a function and you could call it directly. Now as i get it you first define steps and their order, then on each step just call some prompts or await sc.NextAsync(), so when i'm trying to call steps like regular functions ( return await FinishOnboardingDialog(sc, cancellationToken); it worked but stack not flushed and i still get next step anyway.



Also i've succesfully used validation aproach, but it's kinda different case, this is good when actual validation happeing and if failed, step just keep reprompting.



Only aproach worked for me is



return await sc.ReplaceDialogAsync(InitialDialogId);


But i'm not sure i get whole idea of this named dialogs, not seems like much of documentation on this topic and no examples in c# in botbuilder-samples project regarding ReplaceDialogAsync.
Though it worked i would like to know if this is the correct way to do such loops and orchestrations and know more about this new named dialogs aproach. Thank you.










share|improve this question





















  • Possible duplicate of Bot framework v4.0 how to execute the previous waterfall step in a dialog
    – JJ_Wailes
    Nov 12 at 17:26










  • actually ReplaceDialogAsync worked for me just fine, suggested solution accepted as answer with context.ActiveDialog.State["stepIndex"] = (int)context.ActiveDialog.State["stepIndex"] -2; seems like a hack for me and will working only for kinda retry. I hope MS will come up with working methods and methodology on how we should use that.
    – VzLOM
    Nov 17 at 17:27














up vote
-1
down vote

favorite












Botbuilder 4.1.1
Classic task: we have waterfall dialog, in ctor i'm defining waterfall describing all steps:



var authenticate = new WaterfallStep

AskForPhone,
FinishOnboardingDialog,
AskWhatToDo,
AskTicketInfo
;

AddDialog(new WaterfallDialog(InitialDialogId, authenticate));
AddDialog(new TextPrompt("phonePrompt", CustomPromptValidatorAsync));
AddDialog(new ChoicePrompt("optionsDialog"));
AddDialog(new TextPrompt("askTicketInfo"));


...
then on one step i'm asking a prompt:



 public async Task<DialogTurnResult> FinishOnboardingDialog(WaterfallStepContext sc, CancellationToken cancellationToken)

_state = await _accessor.GetAsync(sc.Context);

return await sc.PromptAsync("optionsDialog", new PromptOptions()


Choices = new List<Choice>()


new Choice("Create a ticket"),
new Choice("Contact your advisor organization"),
new Choice("Contact AgriSync"),
new Choice("List bot commands"),
,

, cancellationToken);



Then on next step i'm checking the response.



On some of options i want just to collect info and go further. But on some option i would like to reprompt last question or go to some specific step of dialog.
In botbuilder v3 dialogs worked by old style callbacks, so every step was just a function and you could call it directly. Now as i get it you first define steps and their order, then on each step just call some prompts or await sc.NextAsync(), so when i'm trying to call steps like regular functions ( return await FinishOnboardingDialog(sc, cancellationToken); it worked but stack not flushed and i still get next step anyway.



Also i've succesfully used validation aproach, but it's kinda different case, this is good when actual validation happeing and if failed, step just keep reprompting.



Only aproach worked for me is



return await sc.ReplaceDialogAsync(InitialDialogId);


But i'm not sure i get whole idea of this named dialogs, not seems like much of documentation on this topic and no examples in c# in botbuilder-samples project regarding ReplaceDialogAsync.
Though it worked i would like to know if this is the correct way to do such loops and orchestrations and know more about this new named dialogs aproach. Thank you.










share|improve this question





















  • Possible duplicate of Bot framework v4.0 how to execute the previous waterfall step in a dialog
    – JJ_Wailes
    Nov 12 at 17:26










  • actually ReplaceDialogAsync worked for me just fine, suggested solution accepted as answer with context.ActiveDialog.State["stepIndex"] = (int)context.ActiveDialog.State["stepIndex"] -2; seems like a hack for me and will working only for kinda retry. I hope MS will come up with working methods and methodology on how we should use that.
    – VzLOM
    Nov 17 at 17:27












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











Botbuilder 4.1.1
Classic task: we have waterfall dialog, in ctor i'm defining waterfall describing all steps:



var authenticate = new WaterfallStep

AskForPhone,
FinishOnboardingDialog,
AskWhatToDo,
AskTicketInfo
;

AddDialog(new WaterfallDialog(InitialDialogId, authenticate));
AddDialog(new TextPrompt("phonePrompt", CustomPromptValidatorAsync));
AddDialog(new ChoicePrompt("optionsDialog"));
AddDialog(new TextPrompt("askTicketInfo"));


...
then on one step i'm asking a prompt:



 public async Task<DialogTurnResult> FinishOnboardingDialog(WaterfallStepContext sc, CancellationToken cancellationToken)

_state = await _accessor.GetAsync(sc.Context);

return await sc.PromptAsync("optionsDialog", new PromptOptions()


Choices = new List<Choice>()


new Choice("Create a ticket"),
new Choice("Contact your advisor organization"),
new Choice("Contact AgriSync"),
new Choice("List bot commands"),
,

, cancellationToken);



Then on next step i'm checking the response.



On some of options i want just to collect info and go further. But on some option i would like to reprompt last question or go to some specific step of dialog.
In botbuilder v3 dialogs worked by old style callbacks, so every step was just a function and you could call it directly. Now as i get it you first define steps and their order, then on each step just call some prompts or await sc.NextAsync(), so when i'm trying to call steps like regular functions ( return await FinishOnboardingDialog(sc, cancellationToken); it worked but stack not flushed and i still get next step anyway.



Also i've succesfully used validation aproach, but it's kinda different case, this is good when actual validation happeing and if failed, step just keep reprompting.



Only aproach worked for me is



return await sc.ReplaceDialogAsync(InitialDialogId);


But i'm not sure i get whole idea of this named dialogs, not seems like much of documentation on this topic and no examples in c# in botbuilder-samples project regarding ReplaceDialogAsync.
Though it worked i would like to know if this is the correct way to do such loops and orchestrations and know more about this new named dialogs aproach. Thank you.










share|improve this question













Botbuilder 4.1.1
Classic task: we have waterfall dialog, in ctor i'm defining waterfall describing all steps:



var authenticate = new WaterfallStep

AskForPhone,
FinishOnboardingDialog,
AskWhatToDo,
AskTicketInfo
;

AddDialog(new WaterfallDialog(InitialDialogId, authenticate));
AddDialog(new TextPrompt("phonePrompt", CustomPromptValidatorAsync));
AddDialog(new ChoicePrompt("optionsDialog"));
AddDialog(new TextPrompt("askTicketInfo"));


...
then on one step i'm asking a prompt:



 public async Task<DialogTurnResult> FinishOnboardingDialog(WaterfallStepContext sc, CancellationToken cancellationToken)

_state = await _accessor.GetAsync(sc.Context);

return await sc.PromptAsync("optionsDialog", new PromptOptions()


Choices = new List<Choice>()


new Choice("Create a ticket"),
new Choice("Contact your advisor organization"),
new Choice("Contact AgriSync"),
new Choice("List bot commands"),
,

, cancellationToken);



Then on next step i'm checking the response.



On some of options i want just to collect info and go further. But on some option i would like to reprompt last question or go to some specific step of dialog.
In botbuilder v3 dialogs worked by old style callbacks, so every step was just a function and you could call it directly. Now as i get it you first define steps and their order, then on each step just call some prompts or await sc.NextAsync(), so when i'm trying to call steps like regular functions ( return await FinishOnboardingDialog(sc, cancellationToken); it worked but stack not flushed and i still get next step anyway.



Also i've succesfully used validation aproach, but it's kinda different case, this is good when actual validation happeing and if failed, step just keep reprompting.



Only aproach worked for me is



return await sc.ReplaceDialogAsync(InitialDialogId);


But i'm not sure i get whole idea of this named dialogs, not seems like much of documentation on this topic and no examples in c# in botbuilder-samples project regarding ReplaceDialogAsync.
Though it worked i would like to know if this is the correct way to do such loops and orchestrations and know more about this new named dialogs aproach. Thank you.







botframework






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 16:15









VzLOM

136




136











  • Possible duplicate of Bot framework v4.0 how to execute the previous waterfall step in a dialog
    – JJ_Wailes
    Nov 12 at 17:26










  • actually ReplaceDialogAsync worked for me just fine, suggested solution accepted as answer with context.ActiveDialog.State["stepIndex"] = (int)context.ActiveDialog.State["stepIndex"] -2; seems like a hack for me and will working only for kinda retry. I hope MS will come up with working methods and methodology on how we should use that.
    – VzLOM
    Nov 17 at 17:27
















  • Possible duplicate of Bot framework v4.0 how to execute the previous waterfall step in a dialog
    – JJ_Wailes
    Nov 12 at 17:26










  • actually ReplaceDialogAsync worked for me just fine, suggested solution accepted as answer with context.ActiveDialog.State["stepIndex"] = (int)context.ActiveDialog.State["stepIndex"] -2; seems like a hack for me and will working only for kinda retry. I hope MS will come up with working methods and methodology on how we should use that.
    – VzLOM
    Nov 17 at 17:27















Possible duplicate of Bot framework v4.0 how to execute the previous waterfall step in a dialog
– JJ_Wailes
Nov 12 at 17:26




Possible duplicate of Bot framework v4.0 how to execute the previous waterfall step in a dialog
– JJ_Wailes
Nov 12 at 17:26












actually ReplaceDialogAsync worked for me just fine, suggested solution accepted as answer with context.ActiveDialog.State["stepIndex"] = (int)context.ActiveDialog.State["stepIndex"] -2; seems like a hack for me and will working only for kinda retry. I hope MS will come up with working methods and methodology on how we should use that.
– VzLOM
Nov 17 at 17:27




actually ReplaceDialogAsync worked for me just fine, suggested solution accepted as answer with context.ActiveDialog.State["stepIndex"] = (int)context.ActiveDialog.State["stepIndex"] -2; seems like a hack for me and will working only for kinda retry. I hope MS will come up with working methods and methodology on how we should use that.
– VzLOM
Nov 17 at 17:27

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250648%2freprompt-go-back-go-to-specific-step-in-waterfall-dialog%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53250648%2freprompt-go-back-go-to-specific-step-in-waterfall-dialog%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto