Dynamically slots creation not working in actions

Hi Team,

I have used earlier the below functionality. kindly help , how will in rasa 2.x replace this in actions. for forms, i have created formvalidation class but here i am able to do only validation of slots but how to do dynamically check the slots.

below is 1.x code.

    **def request_next_slot(**
**        self,**
**        dispatcher: "CollectingDispatcher",**
**        tracker: "Tracker",**
**        domain: Dict[Text, Any],**
**    ) -> Optional[List[EventType]]:**
        """Request the next slot and utter template if needed,
            else return None"""

        # Check whether user entered any vendor name/number via input message
        access_data = get_access_data(tracker)
        vendor_id = access_data["vendor_id"] if "vendor_id" in access_data.keys() else ""
        input_vendor = tracker.get_slot("vendor_name_number") if tracker.get_slot('vendor_name_number') else ''
        if input_vendor is not None and input_vendor != "" and input_vendor != vendor_id:
            dispatcher.utter_message("Please change the vendor in the vendor selection bar above and query again.")
            return [AllSlotsReset()]

        # Define variable for vendor api response and region/sites
        api_resp = {}
        reg_loc = {}

        for slot in self.required_slots(tracker):
            if self._should_request_slot(tracker, slot):
                logger.debug(f"Request next slot '{slot}'")

                if slot in ["region", "site_location"]:
                    # Call the vendor API and get response
                    api_handler = ApiHandler()
                    if len(api_resp) <= 0:
                        api_resp = api_handler.get_call(tracker=tracker, api_text="vendor_api", params={})

                    # If response contains error then give the error msg as bot output
                    if "error_msg" in api_resp:
                        dispatcher.utter_message(api_resp["error_msg"], **tracker.slots)
                        return [SlotSet(REQUESTED_SLOT, slot)]

                    # Collect the regions (as key) and related sites (as values) from response
                    if len(reg_loc) <= 0:
                        if "locations" in api_resp.keys() and len(api_resp["locations"]) > 0:
                            for item in api_resp["locations"]:
                                if item["regionId"] not in reg_loc.keys():
                                    reg_loc[item["regionId"]] = [item["vendorSiteName"]]
                                else:
                                    reg_loc[item["regionId"]].append(item["vendorSiteName"])

                    # Check if slot is region then select if it is single or give the option to chose from user
                    if slot == "region" or tracker.get_slot("region") is None:
                        reg_keys = list(reg_loc.keys())
                        # Check whether the region single/multiple to set slot
                        if len(reg_keys) > 0 and len(reg_keys) == 1:
                            tracker.slots["region"] = reg_keys[0]
                        else:
                            # Multiple regions select option as bot response
                            regions = dict((v, k) for k, v in self.regions().items())
                            buttons = []
                            for num in reg_keys:
                                buttons.append({"title": f"{regions[num]}", "payload": f"{regions[num]}"})
                            if len(buttons) > 0:
                                dispatcher.utter_message("Please select the region", buttons=buttons, **tracker.slots)
                            else:
                                dispatcher.utter_message("The selected vendor has no locations", **tracker.slots)
                                return None
                            return [SlotSet(REQUESTED_SLOT, slot)]

Hi Rasa Team,

Please check above issue and provide some solution in rasa 2.x

Thanks and Regards, Edukondalu

Hi Rasa Team,

Some on help me on it, I have gone through documentation but not able to make it work.

thanks in advance, regards, edukondalu