Can form flow fields in bot framework be pre-populated?

前端 未结 2 1533
名媛妹妹
名媛妹妹 2021-01-13 19:55

I have used formflow to ask several questions and to finally fill up a form. A unique id is generated and given to user at the end. Now using that unique id I want to edit t

相关标签:
2条回答
  • 2021-01-13 20:23

    Sure you can pre-populate the formflow fields Firstly you will look for the fields that you want to populate and then add them to the entity list

    I am using LUIS and if i find a suitable entity from my LUIS result i will add it to the form to be pre-populated.

     var entities = new List<EntityRecommendation>(result.Entities);
      if (entities.Any(e => e.Type == "IdNumber"))
            {
                entities.Add(new EntityRecommendation(type: "IdNumber") { Entity = entities.FirstOrDefault(e => e.Type == "IdNumber").Entity});
            }
    

    This will be done before you call your form to be built. Just make sure your "type" is the property name of your class. "Entity" will be the value

    0 讨论(0)
  • 2021-01-13 20:40

    Yes, you can pass an instance of your Form state/model to the FormDialog with the Form parameters pre-filled (as you can see here). Have in mind that . if you do that, any step for filling a field is skipped if that field has a value.

    If you still want to ask for those parameters even if they have a value; you must change the FormOptions and use FormOptions.PromptFieldsWithValues, which will prompt for fields, but use the passed in state for defaults.

    The relevant docs for this are here.

    0 讨论(0)
提交回复
热议问题