# How to call different story based on slot value status

**URL:** <https://forum.rasa.com/t/how-to-call-different-story-based-on-slot-value-status/13509>\
**Category:** Rasa Open Source\
**Created:** [July 25, 2019, 6:33am UTC](https://forum.rasa.com/t/how-to-call-different-story-based-on-slot-value-status/13509 "2019-07-25T06:33:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 25, 2019, 6:33am UTC](https://forum.rasa.com/t/how-to-call-different-story-based-on-slot-value-status/13509/1 "2019-07-25T06:33:01Z")

</div>

Hi All,

I am trying to execute different flow or story in my project based on whether the value of slot is filled or not. How can achieve. Right now I am trying but it’s not working.

Below is my story file code snippet:

```
## leave apply1
* leav_apply
    - action_check_logged_for_leave_apply

## leave apply2
* leav_apply{"emp_code":"OMI-1023","password":"Omfys@345"}
    - slot{"emp_code":"OMI-1023","password":"Omfys@345"}
    - utter_for_no_of_days

```

Based on above story format if slot value is not filled it should go to first flow else move on to second flow. But it’s going for first flow or first story always. Why is that happening can anybody elaborate on that.

---

<div class="post-metadata">

**Author:** ![j.mosig](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/j.mosig/32/3588_2.png) [@j.mosig](https://forum.rasa.com/u/j.mosig)\
**Post date:** [July 25, 2019, 12:51pm UTC](https://forum.rasa.com/t/how-to-call-different-story-based-on-slot-value-status/13509/2 "2019-07-25T12:51:47Z")

</div>

Hi @prashant_kambleCould you please post your domain and nlu files? Also, I think you need at least two intents for the intent classifier to be active.

---

<div class="post-metadata">

**Author:** ![prashant\_kamble](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@prashant\_kamble](https://forum.rasa.com/u/prashant_kamble)\
**Post date:** [July 29, 2019, 3:53am UTC](https://forum.rasa.com/t/how-to-call-different-story-based-on-slot-value-status/13509/3 "2019-07-29T03:53:22Z")

</div>

Hi @j.mosig,

I eventually able to solve it using bool slot datatype. Based on true-false values now I am able to change the story flow. But thanks for your reply. 😊😊

Below is my story and custom action code snippet :

story.md (code snippet):

> ## leave apply1
> 
> - leav\_apply
> - action\_check\_login\_status
> - slot{“login\_status”:true}
> - utter\_for\_no\_of\_days
> - action\_get\_leave\_balance
> - utter\_leave\_option
> 
> ## leave apply3
> 
> - leav\_apply
> - action\_check\_login\_status
> - slot{“login\_status”:false}
> - utter\_service\_failed\_login\_message

actions.py (code snippet):

```
class ActionCheckLoginStatus(Action):
	def name(self):
		return 'action_check_login_status'
		
	def run(self, dispatcher, tracker, domain):
		emp_code = tracker.get_slot('emp_code')
		password = tracker.get_slot('password')
		print("employee code is",emp_code)
		print("password is",password)

		intent = tracker.latest_message['intent'].get('name')

		login_stauts = False
		

		if emp_code is None or password is None:
			return [SlotSet('login_status',False)]
		else:
			return [SlotSet('login_status',True)]

		return []

```

This is how I achieved 🙂

---

<div class="post-metadata">

**Author:** ![madanmeena](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/madanmeena/32/10596_2.png) [@madanmeena](https://forum.rasa.com/u/madanmeena)\
**Post date:** [July 16, 2020, 3:39pm UTC](https://forum.rasa.com/t/how-to-call-different-story-based-on-slot-value-status/13509/4 "2020-07-16T15:39:39Z")

</div>

I am facing similar situation and might go with your approach. Additional question, what if you want to set all of your slots from previous conversations when ever a session start, not all slot value may come from the conversation though.
