# How to confirm forms slots

**URL:** <https://forum.rasa.com/t/how-to-confirm-forms-slots/36864>\
**Category:** Rasa Open Source\
**Created:** [November 10, 2020, 2:11pm UTC](https://forum.rasa.com/t/how-to-confirm-forms-slots/36864 "2020-11-10T14:11:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![laujen](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/laujen/32/11145_2.png) [@laujen](https://forum.rasa.com/u/laujen)\
**Post date:** [November 10, 2020, 2:11pm UTC](https://forum.rasa.com/t/how-to-confirm-forms-slots/36864/1 "2020-11-10T14:11:07Z")

</div>

I’m trying to create a form to set an appointment where the user is prompted to confirm the appointment once the `appointment_type` and `time` slots are filled.

This is my form in the `domain.yml`

```auto
  appointment_form:
    appointment_type:
      - type: from_text
        entity: appointment_type
        intent: inform
    time:
      - type: from_text
        entity: time
        intent: inform

```

then I added two stories, one for the happy path and one for the unhappy path in which the user doesn’t confirm. I’ve done this through stories as I want to use custom actions at different points:

```auto

- story: new appointment happy path
  steps:
  - active_loop: appointment_form 
  - slot_was_set:
    - appointment_type: mri
  - slot_was_set:
    - time: "2020-11-11T12:00:00.000-08:00"
  - action: validate_appointment_form
  - intent: affirm 
  - action: save_appointment_to_db

- story: new appointment unhappy path 0 
  steps:
  - active_loop: appointment_form 
  - slot_was_set:
    - appointment_type: mri
  - slot_was_set:
    - time: "2020-11-11T12:00:00.000-08:00"
  - action: validate_appointment_form
  - intent: deny
  - action: clear_appointment_form

```

I think the two stories are conflicting as if I have a custom action `clear_appointment_form` at the end of the unhappy story, neither of the two stories works (the custom action only prints a message to the user for now). However if I have ` - action: utter_greet` instead of the action aat the end of the story the two work as expected.

What am I doing wrong? Are happy paths for forms something that was deprecated or is this the correct way of using a form happy path?

---

<div class="post-metadata">

**Author:** ![jusce17](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/jusce17/32/10023_2.png) [@jusce17](https://forum.rasa.com/u/jusce17)\
**Post date:** [November 10, 2020, 3:02pm UTC](https://forum.rasa.com/t/how-to-confirm-forms-slots/36864/2 "2020-11-10T15:02:46Z")

</div>

Hi @laujenI think you can do this

1. on your custom actions, in the required slots add one more “confirm”
2. then create a slot map function to receive the confirmation or denial from the user
3. On your domain add, user\_ask\_confirm with buttons to make sure the user either affirms or denies

I hope it helps.

Eden

> **Summary**
>
> on your custom actions, in the required slots add one more “confirm”
> 
> ```
> @staticmethod
> def required_slots(tracker: Tracker) -> List[Text]:
> """A list of required slots that the form has to fill"""
> 
> ##TODO: define required slots
> return ["your_slot", "your_slot", "confirm"]
> 
> ```
> 
> then create a slot map function to receive the confirmation or denial from the user
> 
> ```
> def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:  
> 
> return {
>  
> "confirm": [
> ##TODO: set the slot mapping for the slot "confirm" based on the intent value
> self.from_intent(value = True, intent="affirm"),
> self.from_intent(value = False, intent="deny")
> ],
> }
> 
> ```
> 
> On your domain add, user\_ask\_confirm with buttons to make sure the user either affirms or denies
> 
> ```
> utter_ask_confirm:
> - buttons:
> - payload: /affirm
> title: Yes
> - payload: /deny
> title: No, cancel the appointment
> text: "are you sure you want to book the appointment"
> 
> ```

---

<div class="post-metadata">

**Author:** ![laujen](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/laujen/32/11145_2.png) [@laujen](https://forum.rasa.com/u/laujen)\
**Post date:** [November 10, 2020, 6:20pm UTC](https://forum.rasa.com/t/how-to-confirm-forms-slots/36864/3 "2020-11-10T18:20:20Z")

</div>

thanks @jusce17 I was thinking of that but wasn’t sure if it was the way to do it or a sort of “workaround” I’ll try it out thanks!
