Reminder schedule not working from FormValidationAction

Reminder schedule when form is active does not trigger the reminder event instead fills in the forms next slot. Also not able to schedule from FormValidationAction

We are using the latest version of rasa.

class Mobile_Number_Action(FormAction):

    def name(self):
        return "mobile_number_action"

   
   
    def submit(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[Dict]:
        try:
            dispatcher.utter_message(text="thank you")
            return []
        except:
            return reset_slots(tracker)


    def request_next_slot(
        self,
        dispatcher: "CollectingDispatcher",
        tracker: "Tracker",
        domain: Dict[Text, Any],
    ) -> Optional[List[EventType]]:

        for slot in self.required_slots(tracker):
            print("slot ",slot)
            if self._should_request_slot(tracker, slot):
                dispatcher.utter_message(template=f"utter_ask_{slot}", **tracker.slots)
                input_count = tracker.slots.get('input_count')
               
                dt = datetime.datetime.now() + datetime.timedelta(seconds=ALERT_USER_TIMEOUT)
                return [
                    SlotSet("requested_slot", slot),
                    ReminderScheduled(
                        "external",
                        trigger_date_time=dt,
                        kill_on_user_message=True)
                    ]
        return None


    def validate_customer_first_name(
        self,
        value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> Dict[Text, Any]:
        """Validate mobile_number value."""
        
        print("The external reminder fills in the slot instead of trigerring the rule")

        if value == "EXTERNAL: external":
            return {"customer_first_name":None}
        return {"customer_first_name":value}

Welcome to the community :slight_smile:

Can you show what you’re doing inside the code?

Tip: To properly format code on the Forum, please put three backticks (```) a line before and a line after the code

```
like this
```

Hi chris I updated the code to the question. kindly review.

Some mistakes I noticed:

  1.  class Mobile_Number_Action(FormAction):
    

    should be

    class MobileNumberAction(FormValidationAction):
    
  2.  return "mobile_number_action"
    

    Is that the name of the form as specified in the domain?

  3.  def submit(...)
    

    This whole method isn’t used anywhere in your code and is not a default form method. If you want to execute that when the form is done, you should do so in another action and use a story/rule:

    - rule: Submit form
      condition:
      - active_loop: restaurant_form
      steps:
      - action: restaurant_form
      - active_loop: null
      - slot_was_set:
        - requested_slot: null
      - action: action_submit
    
  4.  def request_next_slot(...)
    

    This whole method also isn’t used anywhere in your code and is not a default form method. I think you’re looking for the required_slots() method.

  5.  return [
         SlotSet("requested_slot", slot),
         ReminderScheduled(
             "external",
             trigger_date_time=dt,
             kill_on_user_message=True)
     ]
    

    You cannot set events in FormValidationActions.

    To set the requested slot, you should return a list of slot names to request in the required_slots() method.

Please carefully read the docs for Forms, especially the “Advanced Usage” section.