# Slot will be filled by Role late, while activating a form

**URL:** <https://forum.rasa.com/t/slot-will-be-filled-by-role-late-while-activating-a-form/40196>\
**Category:** Rasa Open Source\
**Created:** [February 15, 2021, 12:55am UTC](https://forum.rasa.com/t/slot-will-be-filled-by-role-late-while-activating-a-form/40196 "2021-02-15T00:55:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liangda-w](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/liangda-w/32/12296_2.png) [@Liangda-w](https://forum.rasa.com/u/Liangda-w)\
**Post date:** [February 15, 2021, 12:55am UTC](https://forum.rasa.com/t/slot-will-be-filled-by-role-late-while-activating-a-form/40196/1 "2021-02-15T00:55:52Z")

</div>

Hi Rasa community,

I’m confused by a problem:

When I activate a form with `inform` intent and want to set the first requested slot with role, it’s not working. More specific, this slot will be set after the `requested_slot` is set, so bot will ask again for this slot.

For example the form is activated with this utterance: ` I want to order a [blue](req_color) sofa for [4]{"entity": "custom_number", "role": "req_size_num_persons"} people`, it give the following action history, this utterance will be validated twice and `req_size_num_persons` slot is set in the second validation. However, the next `requested_slot` is still `req_size_num_persons`, so the form ask again for the `req_size_num_persons`, even though this slot is already set. And the next message from user to set the slot `req_size_num_persons` will be then fully ignored.

This problem happens only with slots which should be extracted from roles. For other slots which are extracted from entities, there is no problem.

```
Tracker slots : {'appoint_time': None, 'req_color': 'blue', 'req_feet': None, 'req_is_placed_at_wall': None, 'req_material': None, 'req_price': None, 'req_price_ma
x': None, 'req_price_min': None, 'req_shape': None, 'req_size': None, 'req_size_depth': None, 'req_size_height': None, 'req_size_length': None, 'req_size_num_perso
ns': None, 'req_size_width': None, 'req_sleep_function': None, 'req_stuffing': None, 'req_style': None, 'req_wood': None, 'requested_slot': None}
Validations : [{'event': 'slot', 'timestamp': None, 'name': 'req_color', 'value': 'blue'}]
ask next: req_size_num_persons
Tracker slots : {'appoint_time': None, 'req_color': 'blue', 'req_feet': None, 'req_is_placed_at_wall': None, 'req_material': None, 'req_price': None, 'req_price_ma
x': None, 'req_price_min': None, 'req_shape': None, 'req_size': None, 'req_size_depth': None, 'req_size_height': None, 'req_size_length': None, 'req_size_num_perso
ns': '4', 'req_size_width': None, 'req_sleep_function': None, 'req_stuffing': None, 'req_style': None, 'req_wood': None, 'requested_slot': None}
Validations : [{'event': 'slot', 'timestamp': None, 'name': 'req_size_num_persons', 'value': '4'}, {'event': 'slot', 'timestamp': None, 'name': 'req_color', 'value
': 'blue'}]
ask next: req_size

```

**Custom Action:**

```
class ValidateCouchRequirementsForm(FormValidationAction):

    internal_tracker = {}

    def name(self) -> Text:
        return "validate_couch_requirements_form"

    async def run(
            self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
    ) -> List[EventType]:
        vals = await super().run(dispatcher, tracker, domain)
        # Dynamically set which and how many slots should be asked for
        required_slots = ["req_size_num_persons"] + ValidateCouchRequirementsForm.get_req_size_slots(tracker) \
                          + ["req_color", "req_sleep_function", "req_is_placed_at_wall", "req_shape",
                             "req_material", "req_stuffing", "req_style"] + \
                          ValidateCouchRequirementsForm.get_price_slots(tracker)
        print("Tracker slots : {}".format(tracker.slots))
        print("Validations : {}".format(vals))
        for slot_name in required_slots:
            if tracker.slots.get(slot_name) is None or [val for val in vals
                        if (val["name"]==slot_name and val["value"]==None)]:
                # The slot is not filled yet. Request the user to fill this slot next.
                print("ask next: " + slot_name)
                return [SlotSet("requested_slot", slot_name)] + vals

        # All slots are filled.
        return [SlotSet("requested_slot", None)] + vals

```

**Part of Domain file**

```
entities:
  - custom_number:
      roles:
        - req_size_num_persons
        - req_size
        - req_size_length
        - req_size_width
        - req_price
        - req_price_max
        - req_price_min
....

slots:
  req_size_num_persons:
     type: float
     max_value: 12
     min_value: 1
     influence_conversation: false

```

This happens really weird to me. Could someone help me with this problem? Thanks a lot!

---

<div class="post-metadata">

**Author:** ![rctatman](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rctatman/32/6734_2.png) [@rctatman](https://forum.rasa.com/u/rctatman)\
**Post date:** [February 16, 2021, 6:28pm UTC](https://forum.rasa.com/t/slot-will-be-filled-by-role-late-while-activating-a-form/40196/2 "2021-02-16T18:28:46Z")

</div>

Ah, this sounds like a bug (since roles are an [experimental feature](https://rasa.com/docs/rasa/nlu-training-data#entities-roles-and-groups) it’s not surprising to run into one now and again). I would file [a github issue](https://github.com/RasaHQ/rasa/issues) for it. 🙂

---

<div class="post-metadata">

**Author:** ![Liangda-w](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/liangda-w/32/12296_2.png) [@Liangda-w](https://forum.rasa.com/u/Liangda-w)\
**Post date:** [February 16, 2021, 11:32pm UTC](https://forum.rasa.com/t/slot-will-be-filled-by-role-late-while-activating-a-form/40196/3 "2021-02-16T23:32:15Z")

</div>

Thank you for the reply! I opened an issue [here](https://github.com/RasaHQ/rasa/issues/7973) 🙂
