I am trying to build a simple BOT using microsoft Bot framework version 3 where i am using FormFlow. The free text entered by the user is sent to LUIS which returns some intent/entity. Using the entities returned by the LUIS i need to fetch data from database and use the data in BuildForm method.
By using the code as written below, i am able to get entities from LUIS and fetch data from database.
But, I could not find any way to use the data fetched from DB in my BuildForm method.
To summarize: I want to access the Data fetched in LuisDialog's method from BuildForm method of MessageController.
Any help will be highly appreciated.
**MessageController**
public virtual async Task<HttpResponseMessage> Post([FromBody] Activity activity)
{
......
await Conversation.SendAsync(activity, MakeRoot);
}
internal static IDialog<TestRequest> MakeRoot()
{
return Chain.From(() => new TestDialog(BuildForm));
}
private static IForm<TestRequest> BuildForm()
{
return builder.Message("")
.Field(nameof(TestRequest.searchResult))
.Build
}
**LUISDialog:**
class TestDialog : LuisDialog<TestRequest>
{
[LuisIntent("testIntent")]
public async Task GetTestIntentForm(IDialogContext context, LuisResult result)
{
// Pass the intent & entity to DBAccess class which returns list of string
List<string> lstResult = DBAccess.getInfoFromDB("testIntent", entities);
IDialog<TestRequest> testForm = new FormDialog<TestRequest>(new TestRequest(), this.MakeTestForm, FormOptions.PromptInStart, entities);
context.Call<TestRequest>(testForm, TestFormComplete);
}
}
**TestRequest**
[Serializable]
class TestRequest
{
[Prompt("This is the search result")]
public string searchResult;
....
}