# How to do check the slot condition is set and select the right action

**URL:** <https://forum.rasa.com/t/how-to-do-check-the-slot-condition-is-set-and-select-the-right-action/50132>\
**Category:** Rasa Open Source\
**Created:** [December 19, 2021, 5:45am UTC](https://forum.rasa.com/t/how-to-do-check-the-slot-condition-is-set-and-select-the-right-action/50132 "2021-12-19T05:45:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhenglun1234](https://avatars.discourse-cdn.com/v4/letter/z/bb73d2/32.png) [@zhenglun1234](https://forum.rasa.com/u/zhenglun1234)\
**Post date:** [December 19, 2021, 5:45am UTC](https://forum.rasa.com/t/how-to-do-check-the-slot-condition-is-set-and-select-the-right-action/50132/1 "2021-12-19T05:45:03Z")

</div>

Hi, I’m new here for RASA. I have question on how to write a single story instead of 2 where if a slot is set then will choose action A; else choose action B. For instance I have the intent, response, and story below:

nlu.yml

```auto
intent: ask_project_group
  examples: |
    - What are the Unix groups needed for [ProjectX](project_code)?
    - If I work on [ProjectY](project_code), what are the groups I need?
    - What groups I need?
    - I work for [ProjectZ](project_code), what groups I will need?
    - Any groups I need to include?
    - What groups I should wash?

intent: give_project_code
  examples: | 
    - [ProjectX](project_code)
    - I work on [ProjectA](project_code)
    - [ProjectC](project_code)
    - Here, [projectN](project_code)
    - Ok, [ProjectE](project_code)

```

Note that some examples in “ask\_project\_group” do not provide the “project\_code”

domain.yml

```auto
utter_ask_project:
  - text: What project you are working on?
  - text: Could you provide the project code?

```

story.yml

```auto
story: Ask project groups - project_code provided
  - intent: ask_project_code
  - slot_was_set:
    - project_code
  - action: get_project_code   

story: Ask project groups - no project_code provided
  - intent: ask_project_code
  - slot_was_not_set:
    - project_code
  - action: utter_ask_project
  - intent: give_project_code
  - action: get_project_code   

```

Note that the get\_project\_code is custom action that will query details from some database and return value to user.

How can I combine it into single story where if the “project\_code” is found then go for action “get\_project\_code”; else, add an action of “utter\_ask\_project” then proceed to “get\_project\_code”? Thanks.

---

<div class="post-metadata">

**Author:** ![xhyxxj](https://avatars.discourse-cdn.com/v4/letter/x/35a633/32.png) [@xhyxxj](https://forum.rasa.com/u/xhyxxj)\
**Post date:** [May 25, 2022, 11:12am UTC](https://forum.rasa.com/t/how-to-do-check-the-slot-condition-is-set-and-select-the-right-action/50132/2 "2022-05-25T11:12:17Z")

</div>

hello,why you can use slot\_was\_not\_set？there my rasa is wrong
