# How to active, validate and deactivate slot filling (FormAction) in custom action

**URL:** https://forum.rasa.com/t/how-to-active-validate-and-deactivate-slot-filling-formaction-in-custom-action/7071
**Category:** Rasa Open Source
**Created:** [April 16, 2019, 3:20am UTC](https://forum.rasa.com/t/how-to-active-validate-and-deactivate-slot-filling-formaction-in-custom-action/7071 "2019-04-16T03:20:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![txdat](https://avatars.discourse-cdn.com/v4/letter/t/ecc23a/32.png) [@txdat](https://forum.rasa.com/u/txdat)
#### Post date: [April 16, 2019, 3:20am UTC](https://forum.rasa.com/t/how-to-active-validate-and-deactivate-slot-filling-formaction-in-custom-action/7071/1 "2019-04-16T03:20:06Z")

</div>

Hello, I want to create action with checking slots (slot filling) before doing anything, if slots are None, active form and fill. After that, rerun this action. How to do it? Thanks!

```python
class action_complain_price_response(Action):
    def name(self): # type: () -> Text
        return self. __class__. __name__

    def run(
        self,
        dispatcher, # type: CollectingDispatcher
        tracker, # type: Tracker
        domain, # type: Dict[Text, Any]
    ): # type: (...) -> List[Dict[Text, Any]]
        curr = current_products.get(tracker.sender_id, None)
        if curr is None or time.time() - curr["timestamp"] >= PRODUCT_KEPT_TIME:
            # remove product
            try:
                current_products.pop(tracker.sender_id)

            except Exception as e:
                pass

            dispatcher.utter_message(
                "Anh/chị chưa chọn sản phẩm nào, mời anh/chị chọn sản phẩm"
            )

            # callback to response
            return [Form("product_form"), FormValidation("product_form")] # callback

        dispatcher.utter_message(
            "Với sản phẩm {} {} có giá {} VNĐ và phí cập nhật hàng năm là {} VNĐ"
            "anh/chị sẽ có được:\n"
            "- Chất lượng sản phẩm cao: đầy đủ nghiệp vụ, tính năng thông minh, báo cáo điều "
            "hành quản trị nhiều tiêu chí, phát triển sản phẩm theo tiêu chuẩn quốc tế (CMMI level 3)\n"
            "- Dịch vụ hỗ trợ tốt: Hơn 100 nhân viên tư vấn 24/7, 365 ngày/năm, đa dạng kênh hỗ trợ\n"
            "- Luôn cập nhật kịp thời các thay đổi của chính sách nhà nước\n"
            "- Sản phẩm SME kết nối trực tiếp với cơ quan thuế để kê khai thuê qua mạng, "
            "phát hành hóa đơn điện tử trực tiếp trên PM, kết nối NH điện tử."
            "".format(
                curr["pname"].upper(),
                curr["ppack"].upper(),
                cvt_number(curr["pprice"]),
                cvt_number(curr["puprice"]),
            )
        )

        return []

```

with above implement, I have this error:

```nohighlight
Anh/chị chưa chọn sản phẩm nào, mời anh/chị chọn sản phẩm
2019-04-16 10:32:58 DEBUG rasa_core.policies.form_policy - There is an active form 'product_form'
2019-04-16 10:32:58 DEBUG rasa_core.policies.ensemble - Predicted next action using policy_0_KerasPolicy
2019-04-16 10:32:58 DEBUG rasa_core.processor - Predicted next action 'action_complain_price_response' with prob 1.00.
2019-04-16 10:32:58 DEBUG rasa_core.actions.action - Calling action endpoint to run action 'action_complain_price_response'.
2019-04-16 10:32:58 DEBUG rasa_core.processor - Action 'action_complain_price_response' ended with events '['Form(product_form)', 'FormValidation(product_form)']'
2019-04-16 10:32:58 DEBUG rasa_core.processor - Bot utterance 'BotUttered(text: Anh/chị chưa chọn sản phẩm nào, mời anh/chị chọn sản phẩm, data: {
  "elements": null,
  "buttons": null,
  "attachment": null
})'
Anh/chị chưa chọn sản phẩm nào, mời anh/chị chọn sản phẩm
2019-04-16 10:32:58 DEBUG rasa_core.policies.form_policy - There is an active form 'product_form'
2019-04-16 10:32:58 DEBUG rasa_core.policies.ensemble - Predicted next action using policy_0_KerasPolicy
2019-04-16 10:32:58 DEBUG rasa_core.processor - Predicted next action 'action_complain_price_response' with prob 1.00.
2019-04-16 10:32:58 DEBUG rasa_core.actions.action - Calling action endpoint to run action 'action_complain_price_response'.
2019-04-16 10:32:58 DEBUG rasa_core.processor - Action 'action_complain_price_response' ended with events '['Form(product_form)', 'FormValidation(product_form)']'
2019-04-16 10:32:58 DEBUG rasa_core.processor - Bot utterance 'BotUttered(text: Anh/chị chưa chọn sản phẩm nào, mời anh/chị chọn sản phẩm, data: {
  "elements": null,
  "buttons": null,
  "attachment": null
})'
2019-04-16 10:32:58 WARNING rasa_core.processor - Circuit breaker tripped. Stopped predicting more actions for sender 'default'

```

---

<div class="post-metadata">

### Author: ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)
#### Post date: [April 23, 2019, 11:34am UTC](https://forum.rasa.com/t/how-to-active-validate-and-deactivate-slot-filling-formaction-in-custom-action/7071/2 "2019-04-23T11:34:32Z")

</div>

Hi, looks like you’re trying to run a FormAction, but your action doesn’t inherit the `FormAction` class. Take a look at the docs [here](https://rasa.com/docs/core/slotfilling/) to learn about form actions and what methods they have to subclass. Forms are perfect for filling any unfilled slots before performing a custom action.
