# How to set value of other slots in slot\_mappings

**URL:** <https://forum.rasa.com/t/how-to-set-value-of-other-slots-in-slot-mappings/15026>\
**Category:** Rasa Open Source\
**Created:** [August 30, 2019, 7:31am UTC](https://forum.rasa.com/t/how-to-set-value-of-other-slots-in-slot-mappings/15026 "2019-08-30T07:31:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gskprasad1](https://avatars.discourse-cdn.com/v4/letter/g/bcef8e/32.png) [@gskprasad1](https://forum.rasa.com/u/gskprasad1)\
**Post date:** [August 30, 2019, 7:31am UTC](https://forum.rasa.com/t/how-to-set-value-of-other-slots-in-slot-mappings/15026/1 "2019-08-30T07:31:16Z")

</div>

I want to set value of ‘color’ with that of another slot ‘color\_suggestion’, when user give affirm intent to earlier suggestion. how to do it?

sample dialog: User: pls suggest the color  
## in custom action get a color suggestion. color\_suggestion slot is set to Red. bot: Red looks great on you. user: please go ahead. ## on affirmation, I want to set Color slot from color\_suggestion

I am trying to set in slot\_mappings “color”: [self.from\_entity(entity=“COLR”,intent=“choose\_color”), self.from\_intent(intent=“affirm”,---- I want to get value of color\_suggestion slot and set it to color---- ),]

---

<div class="post-metadata">

**Author:** ![amn41](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/amn41/32/20_2.png) [@amn41](https://forum.rasa.com/u/amn41)\
**Post date:** [September 2, 2019, 5:11pm UTC](https://forum.rasa.com/t/how-to-set-value-of-other-slots-in-slot-mappings/15026/2 "2019-09-02T17:11:32Z")

</div>

to do this you’ll have to create your own slot extraction method, so instead of `from_entity` it’ll be `from_affirmation_of_another_slot` or something like that. That will look like the `from_intent` method except take the value from the other slot

---

<div class="post-metadata">

**Author:** ![gskprasad1](https://avatars.discourse-cdn.com/v4/letter/g/bcef8e/32.png) [@gskprasad1](https://forum.rasa.com/u/gskprasad1)\
**Post date:** [September 3, 2019, 8:57am UTC](https://forum.rasa.com/t/how-to-set-value-of-other-slots-in-slot-mappings/15026/3 "2019-09-03T08:57:17Z")

</div>

Thanks for your reply. It helped me explore more on this issue.

If I had to implement my own slot extraction method, I had to override methods like extract\_requested\_slot to handle new mapping method type. Instead, I have done the following:

1. On affirm intent, set slot value as “slot:color\_suggestion” :

> self.from\_intent(intent=“affirm”,value=“slot:color\_suggestion”)

1. Handle this in validate method (validate\_color), where I have access to the tracker to fetch the slot value:

> ```
> if value.startswith("slot:"):
> slot_name = value.split(':')[1]
> slot_val = tracker.get_slot(slot_name)
> return {"color": slot_val}
> 
> ```

This worked perfectly fine for me.

---

<div class="post-metadata">

**Author:** ![amn41](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/amn41/32/20_2.png) [@amn41](https://forum.rasa.com/u/amn41)\
**Post date:** [September 3, 2019, 9:22am UTC](https://forum.rasa.com/t/how-to-set-value-of-other-slots-in-slot-mappings/15026/4 "2019-09-03T09:22:36Z")

</div>

that’s a good workaround!
