Activating new form from the current form

Hi,

Is it possible to activate a form from within the submit(…) method of another?

I’m in a situation where I have a form that takes input from user whether she is a new user or an old. If old, I want to take the old token-id from user and fetch from DB it’s details (this I’m doing in a separate form as there are still a few params to be taken from user). If new, start a different form and start taking all user details.

I tried using “tracker.change_form_to()” but it throws error saying Tracker has no such attribute.

I’m obviously doing something wrong here. Could you please help me sort this out.

This is the error stack trace :

E0822 03:05:24.006472  4244 app.py:1761] Exception on /webhook [POST]

Traceback (most recent call last):

 File "c:\users\hp\anaconda3\lib\site-packages\flask\app.py", line 2292, in wsgi_app
   response = self.full_dispatch_request()

 File "c:\users\hp\anaconda3\lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
   rv = self.handle_user_exception(e)

 File "c:\users\hp\anaconda3\lib\site-packages\flask_cors\extension.py", line 161, in wrapped_function
   return cors_after_request(app.make_response(f(*args, **kwargs)))

 File "c:\users\hp\anaconda3\lib\site-packages\flask\app.py", line 1718, in handle_user_exception
   reraise(exc_type, exc_value, tb)

 File "c:\users\hp\anaconda3\lib\site-packages\flask\_compat.py", line 35, in reraise
   raise value

 File "c:\users\hp\anaconda3\lib\site-packages\flask\app.py", line 1813, in full_dispatch_request
   rv = self.dispatch_request()

 File "c:\users\hp\anaconda3\lib\site-packages\flask\app.py", line 1799, in dispatch_request
   return self.view_functions[rule.endpoint](**req.view_args)

 File "c:\users\hp\anaconda3\lib\site-packages\flask_cors\decorator.py", line 128, in wrapped_function
   resp = make_response(f(*args, **kwargs))

 File "c:\users\hp\anaconda3\lib\site-packages\rasa_sdk\endpoint.py", line 59, in webhook
   response = executor.run(action_call)

 File "c:\users\hp\anaconda3\lib\site-packages\rasa_sdk\executor.py", line 245, in run
   events = action(dispatcher, tracker, domain)

 File "c:\users\hp\anaconda3\lib\site-packages\rasa_sdk\forms.py", line 549, in run
   events.extend(self.submit(dispatcher, temp_tracker, domain))

 File "C:\Users\HP\Documents\VBOT\vbot_chatbot_v2.6\actions.py", line 247, in submit
   return (Tracker.change_form_to("vbot_form_3"))

AttributeError: type object 'Tracker' has no attribute 'change_form_to'

Thanks Rahul

Hey there! You should be able to do this with stories and a featurized slot. E.g. if the slot is

slots:
   is_new_user:
      type: bool

then your stories could look something like

## returning user
* greet
  - user_form
  - slot{"is_new_user": false}
  - returning_user_form

## new user
* greet
  - user_form
  - slot{"is_new_user": true}
  - new_user_form

You’re not moving from one form to another, but the first form is setting a slot based on the user input of “yes” or “no” if they’ve used your product before. Then when the featurized slot is set, the stories will drive which form is chosen next.

Does that help?

Thank you Ella !

't has started working.

Glad to hear it!

Hi @erohmensing! Should these stories not be a “rule”? I’m just a bit confused as to when I absolutely NEED to use a story. Most bots could just work on well set rules as well as the (great) nlu entity and intent detection pipelines of rasa?