1

I would like to call child dialog from JSON schema dialog:

Dialog 1

{

  "References": [ "my .dll", "Newtonsoft.Json.dll" ],  
  "Imports": [ "my class", "Newtonsoft.Json.Linq" ],
  "type": "object",
  "required": [
   "Question 1"

   ],
"Templates": {
"NotUnderstood": {
  "Patterns": [ "I do not understand \"{0}\".", "Try again, I don't get \"{0}\"." ]
},
"EnumSelectOne": {
  "Patterns": [ "Please let me know the {&}: {||}" ],
  "ChoiceStyle": "PerLine"
}
},
 "properties": {
 "Question 1": {
  "Prompt": {
    "Patterns": [ "my Question 1 ? {||}" ]
  },
  "type": [
    "string",
    "null"
  ],
  "enum": [
    "Info",
    "Submit an Issue",
    "Track Cases",
    "Finish"
  ]

},
 "OnCompletion": "context.Call(FormDialog.FromForm<JObject>(()=>BuildJsonForm(\"another.json\"),FormOptions.PromptInStart), (con, res) =>CompletedQ1AndQ2(con, res));"

}

Dialog 2

{

  "References": [ "my .dll", "Newtonsoft.Json.dll" ],  
  "Imports": [ "my class2", "Newtonsoft.Json.Linq" ],
  "type": "object",
  "required": [
   "Question 1"

   ],
"Templates": {
"NotUnderstood": {
  "Patterns": [ "I do not understand \"{0}\".", "Try again, I don't get \"{0}\"." ]
},
"EnumSelectOne": {
  "Patterns": [ "Please let me know the {&}: {||}" ],
  "ChoiceStyle": "PerLine"
}
},
 "properties": {
 "Question 2": {
  "Prompt": {
    "Patterns": [ "my Question 2 ? {||}" ]
  },
  "type": [
    "string",
    "null"
  ],
  "enum": [
    "support ",
    "sales ",
    "marketing"
  ]

},
 "OnCompletion": "context.Done<bool>(true);"

}

c# code :

public async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
{
       context.Call(
           FormDialog.FromForm<JObject>(() => BuildJsonForm("Q1.json"),
               FormOptions.PromptInStart), (con, res) => CompletedCaseSubmission(con, res));
}

The issue that CompletedCaseSubmission called after filling Q1 but Q2 dialog did not execute at all. I can call Dialog 2 from CompletedCaseSubmission , but I want do it from JSON. Second question is how to get details of both dialogs Q1 and Q2 in c#?

Vladimir B
  • 170
  • 1
  • 13

1 Answers1

0

There is currently no way of interrupting a form dialog to call another dialog. You can however, break your form into smaller pieces and call other dialogs between the pieces. please refer to the links below for more information:

https://github.com/Microsoft/BotBuilder/issues/3293
How to hook Luis into a Bot Framework FormDialog

D4RKCIDE
  • 3,439
  • 1
  • 18
  • 34
  • Actually as I said before I do can call dialog 2 from dialog 1 : in CompletedCaseSubmission I can call context.call with second dialog. My question is how to do it from JSON schema dialog? – Vladimir B Aug 24 '17 at 22:12
  • @VladimirB FormFlow doesn't provide the ability to call other dialogs while progressing through the flow. It doesn't matter if you are using FormFlow in code, or FormFlow from json. There is currently no mechanism to add a dialog to the stack from within the flow. – Eric Dahlvang Aug 24 '17 at 22:23