Hi, I’m using FormAction to collect information from user and filling few slots with that. Below is the screen of action file:
For “Reason_ar” slot I need to collect input from 5 pre defined options but if uses selects “other” as a reason, in that case only i want to collect open ended text message from uses. Any idea how this will be done ?
Check Justina tutorial on forms. You’ll need to add some custom logic like in the example:
def required_slots(tracker):
# type: () -> List[Text]
"""A list of required slots that the form has to fill"""
if tracker.get_slot('Reason_ar') == 'other':
return ["FromDate_ar", "ToDAte_Ar", "FromTime", "ToTime", "Reason_ar", "OtherReason"]
else:
return ["FromDate_ar", "ToDAte_Ar", "FromTime", "ToTime", "Reason_ar"]
For the open ended text message, you need to add this in your slot_mappings:
"OtherReason": self.from_text(intent=None)
3 Likes
Thanks for reply, will implement this and get back if something comes up.