# Saving data for form actions for each user

**URL:** <https://forum.rasa.com/t/saving-data-for-form-actions-for-each-user/29044>\
**Category:** Rasa Open Source\
**Created:** [May 19, 2020, 10:44am UTC](https://forum.rasa.com/t/saving-data-for-form-actions-for-each-user/29044 "2020-05-19T10:44:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsp0din](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/gsp0din/32/2091_2.png) [@gsp0din](https://forum.rasa.com/u/gsp0din)\
**Post date:** [May 19, 2020, 10:44am UTC](https://forum.rasa.com/t/saving-data-for-form-actions-for-each-user/29044/1 "2020-05-19T10:44:22Z")

</div>

I would like to store some data for each user in a form action, e.g. some metadata of chat so that I can access it in functions like `slot_mappings`, currently I do it via `self.id`. What I found out is that there is only 1 instance of a class so this `self.id` is actually mutual, which isn’t the way I planned.

I know that for this purpose there are slots, but I can’t access them in functions where I have only `self` like `slot_mappings`. What should I do in that case?

For example I can create an instance of a class for each user and store them in a dictionary, then in `run` function I will can `run` of an instance so that information is separate. This also solves synchronization issues

---

<div class="post-metadata">

**Author:** ![chkoss](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chkoss/32/7186_2.png) [@chkoss](https://forum.rasa.com/u/chkoss)\
**Post date:** [May 26, 2020, 3:44pm UTC](https://forum.rasa.com/t/saving-data-for-form-actions-for-each-user/29044/2 "2020-05-26T15:44:49Z")

</div>

What is your use case is for this? How/why do you want to use the metadata in a function like `slot_mappings` and when is this metadata generated?

Maybe an option would be to set some variables that can be accessed by any function in your class (e.g. `self.metainfo1`, `self.metainfo2`) when the form starts. Would that solve your problem?

Setting these variables can be done in the beginning of the `run` function. So you could either directly set them in the `rasa_sdk` code [here](https://github.com/RasaHQ/rasa-sdk/blob/9c0433e4ebb4e141e8010fe2221b5d4153b96d09/rasa_sdk/forms.py#L580), or probably the nicer way would be to override the `run` function in your `MyForm(FormAction)` class such that it first sets the metadata variables and then calls `super.run`.
