Slot_mapping in forms action using Rasa 2.0

Hello Gays, I have a problem with slot mapping in forms. here I have two slots in signup form The both slots are storing same values :

class ValidateSignForm(Action):

def name(self) -> Text:

    return "Sign_form"

def run(

    self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict

) -> List[EventType]:

    required_slots = ["log_emp_id", "log_otp"]

    for slot_name in required_slots:

        if tracker.slots.get(slot_name) is None:

            # The slot is not filled yet. Request the user to fill this slot next.

            return [SlotSet("requested_slot", slot_name)]

    # All slots are filled.

    return [SlotSet("requested_slot", None)]

def slot_mappings(self):

    # type: () -> Dict[Text: Union[Dict, List[Dict]]]


        return { "log_emp_id": 


                    self.from_intent(intent='log emp id')],



                    self.from_intent(intent='log otp')]}

class ActionSignSubmit(Action):

def name(self) -> Text:

    return "action_Sign_submit"

def run(



    tracker: Tracker,

    domain: "DomainDict",

) -> List[Dict[Text, Any]]:


    Emp_Sign_id = tracker.get_slot('log_emp_id')

    Log_Otp = tracker.get_slot('log_otp')


story: Leave Application


  • intent: greet

  • action: utter_greet

  • action: Sign_form

  • active_loop: Sign_form

  • active_loop: null

  • action: action_Sign_submit




  - type: from_entity

    entity: log_emp_id

    intent: log emp id

  - type: from_text 


  - type: from_entity

    entity: log_otp

    intent: log otp

  - type: from_text

@ShahidCloudsys, form have changed, now you can define your required slots and slot mapping just on your domain.yml. You can use your to make slot’s verification and to call an action after all slots are filled. Check out how to implement a form in 2.x. Hope it helps :smiley:

1 Like

Okay @marcos.allysson , Let me try

Hello @marcos.allysson , I defined slot mapping inside Demoain.yml file, Its working but the form deactivating time ‘start date’ and ‘end date’ storing same values in both slots

forms: leave_form: start_date: - type: from_entity entity: start_date intent: start date - type: from_text end_date: - type: from_entity entity: end_date intent: end date - type: from_text reason: - type: from_entity entity: reason intent: reason - type: from_text

Hi @ShahidCloudsys. Looking at the way you defined your mappings, I wonder how Rasa is actually filling in your slots (i.e. what mapping rule is using). It would be helpful if you could run rasa shell --debug and look at the logs.

Okay @humcasma , Thanks for your response