Manually cancel forms

Hi, I would like to manually cancel a form inside a normal action class(as oppose to a form action) in the rasa sdk. How can I achieve this please ?

PS: I know that in the form action, there is a self.deactivate().

Thanks in advance for the reply. Your sincerely.

Do you want to cancel a Rasa Form Action from a custom action or have you made your own form and want to cancel it?

If it is a Rasa Form Action, could you give some context on what are you trying to achieve and why self.deactivate() doesn’t fit your needs?

Hi @GeovanaRamos Thanks for the reply. Assume that a user start a form and while the form is still on hold requesting a particular slot, he make a normal action call. In this scenario, I want to cancel all pending form to proper save the request in the normal action. Does it make sense ?

By “save the request in the normal action” you mean saving the already filled slots? If not, you can try this to cancel the current form and redirect to an action:

story

  • some_intent
    • your_form
    • form{“name”: “your_form”}
  • other_intent
    • your_form
    • form{“name”: null}
    • action_your_action

If you want to carry the filled slots to the normal action, I think you’ll probably have to catch the intent on the validade method if you want to stop on a specific slot or in the request_next_slot method as shown here if the rule applies to all slots, and then call self.deactivate plus a followup action. Although I am not sure if the follow up works in the validate or request_next_slot methods, you could try.