I have multiple FormActions which belong to different story types. Both FormActions need similar inputs with a couple exceptions.
The first requested field (with conditional slot logic) is the email address of the user, which needs to be
- validated by checking if in DB
- if valid, it is used to retrieve some other information from the DB and set slots accordingly. This is needed to get confirmation from the user before executing the FormAction
Now, I tried adding a function to the class that I could use in the validate() function within the FormAction class, similarly as here. But returning the SlotSet event did not change the slots I need to modify (guess because it is within the class). Therefore, I created a custom validation action, that is added to the stories when the email slot is set:
* provideemail{"email": "example@example.no"}
- slot{"email": "example@example.no"}
- action_validateEmail
This action also returns the followup action to be the active FormAction if any is active, or chooses the followup action according to story. This seems to be great because multiple forms need this validation, and if I force the path in online training, the conversation is exactly what I need, it just doesn’t get predicted. It also works without error in online training when the the FormAction is not yet active (e.g. email address is given before request that initiates FormAction.
The problem is that when the FormAction is already activated, once the email address is entered by the user, the validation action never gets predicted. It is always the FormAction that keeps being predicted.
Is there any way to get around this? My ideas and problems:
-
Adding the validation inside the FormAction - cannot set other slots that are required to carry out the form. These are not retrieved from the user, but need to be returned to them before finishing form action
-
The above solution with the external validation - not getting predicted
Please let me know if you have any ideas what could be a get around!