Multiple slots in a form but not all is mandatory

Hey,

I have an issue that I can’t get my way around. I have form with two slots. For the argument’s sake say it is “color” and “carbrand”. I want all of these different cases to work but I am not sure how to make it happen.

  • If user says “I want to see all the red cars” then the bot should list all red cars.
  • If user says “I want to see all the BMWs” then the bot should list all the BMWs.
  • If user says “I want to see all the green BMWs” the bot should list all the green BMWs.

So the form should handle “color” and “carbrand”. But none of them is mandatory. The form is valid as long as one of slots is filled.

What is the best practice to solve this dilemma? Most documentations I find has bot slots as required and then it’s pretty straight forward. But in this case I coming down short. Should I ValidateForm? Should I use a Custom Action? Don’t know. Help please. :slight_smile:

Best regards, /Magnus

In these cases, you don’t want to use forms you can go with the simple slot filling technique… or if you want to go with the slots then after getting the one element from the user then check whether another element slot is null so if it is null fill it with dumb value so the other value is not asked by the bot… it’s better to go with the first method @osterhult

Thanks. A follow up question. So if I go with the simple slot filling technique I still want to have put in some weird logic within the answer (like getting it from somewhere a db or something) should I then use a custom action for this? @prakashr

yes @osterhul you can use custom action for it…

1 Like