0

I have a conversation where a user can enter into a form. Before they can enter the form they need to authenticate and then potentially after authentication they may need to answer a few more questions before the target form is invoked.

So lets say I have 3 dialogs A, B and C. The aim is to display C but we may need to display A and potentially also B first.

How do i neatly create a chain that caters for all scenarios (only C, A and C and A, B and C etc)?

user1371314
  • 762
  • 7
  • 24

1 Answers1

1

You don't need a chain for this. You set C as your root dialog. There you add the logic to check for example if it's authenticated or not. If it's not, then you FWD the message to the A dialog.

From the A dialog you should go back to C and C should decide if this goes to B or not.

In the AzureBot sample, they are doing something pretty similar here. You will see that they are trying to retrieve an auth token; and if the token is not present, they forward the message to the dialog responsible for handling the auth.

If you don't know how to call/fwd to dialogs, please read this.

Community
  • 1
  • 1
Ezequiel Jadib
  • 14,767
  • 2
  • 38
  • 43
  • In this instance my C is a FormDialog, how can i handle the logic without the message pump? Maybe a wrapper dialog? – user1371314 Apr 12 '17 at 10:46
  • If that's the case, I would probable suggest having a root dialog doing the orchestration: root dialog, calls A and B when required and then calls to C – Ezequiel Jadib Apr 12 '17 at 13:12