Activate a Second Form if Slot of Current Form is a Particular Value

I have a form that allows a user to search for items in a library. The final slot in the form is called ‘give_suggestion’, and if set to True, I want the current form to deactivate, and a separate form to be activated to allow the user to give a library suggestion.

I have tried this, but with no luck:

- rule: Activate Suggestion form if search library form ends in suggestion
  condition:
  - active_loop: search_library_form
  steps:
  - action: search_library_form
  - active_loop: null
  - slot_was_set:
    - give_suggestion: True
  - slot_was_set:
    - requested_slot: null
  - action: action_search_library_form_reset
  - action: suggestion_form
  - active_loop: suggestion_form

I also have a separate activation rule for the suggestion form, since should also be possible to activate it separately:

- rule: Activate Suggestion Form
  steps:
  - action: utter_suggestion_form
  - intent: affirm
  - action: suggestion_form
  - active_loop: suggestion_form

And there is also a rule for submitting the search library form if the user does not want to submit a suggestion:


- rule: Submit Search String Form
  condition:
  - active_loop: search_library_form
  steps:
  - action: search_library_form
  - active_loop: null
  - slot_was_set:
    - give_suggestion: False
  - slot_was_set:
    - requested_slot: null
  - action: action_search_library_form_reset
  - action: utter_anything_else

Does anyone know how I can implement this to allow the Suggestion form to be activated after the Search library form only if the give_suggestion slot is set to True?

You can use the FollowUp action call in your form or take a look at the financial-demo bot for examples using stories.

Hi @stephens, thank you for your reply.

Currently the search_library_form is a FormValidationAction. Am I right to say that I would need a FormAction in order to return a FollowUp action, since FormValidationAction can only return slot values?

No, it would be a regular action. You’ll find examples in financial-demo.

1 Like