Is there a way to enter conditions on slots inside a RASA form?

I am creating a basic chatbot using RASA forms. I want to add specific conditions on slots so that when they are true, the next questions in the form will be asked; else it will skip to further questions.

This is my story -


- story: phone/text prefer story
 steps:
 - intent: greet
 - action: utter_greet
 - intent: affirm
 - action: basic_info_form
 - active_loop: basic_info_form
 - or:
   - slot_was_set:
       - contact_prefer: "phone call"
   - slot_was_set:
       - contact_prefer: "text(SMS)"
 - active_loop: null
 - action: utter_thank_you
 - action: action_submit_form

I used the Slot_was_set to check the slots’ value; however, the form asks all the questions regardless of the value of the contact_prefer slot and then ends and submits the form.

Is there something that I am missing here?

Any help will be appreciated. Thanks.

You can use the required_slots method to dynamically set the required slots to anything you want. There’s an example in thedocs here.

1 Like

Do I need to mention this action in the stories.yml? Or does the story automatically refers to this action?