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.
botframework
add a comment |
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.
botframework
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
add a comment |
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.
botframework
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
botframework
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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