# Smart actions Enums with different returned value

**URL:** <https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893>\
**Category:** Help me!\
**Created:** [July 13, 2021, 9:19am UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893 "2021-07-13T09:19:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [July 13, 2021, 9:19am UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893/1 "2021-07-13T09:19:29Z")

</div>

Hello!

Is it possible to have a different returned value than the one displayed in Enums for smart actions?  
for example:  
PARIS = 75  
BORDEAUX = 33  
…

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [July 13, 2021, 9:23am UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893/2 "2021-07-13T09:23:19Z")

</div>

Hello @Simon_BRAMI1,

Please can you explain a bit more on what is your current behavior and what are you trying to achieve? 🙂

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [July 13, 2021, 9:30am UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893/3 "2021-07-13T09:30:17Z")

</div>

I am creating a smart actions with some enum field. Let’s say one city enum with [“Paris”, “Bordeaux”, “Nantes”]  
Currently, the string selected is returned to my action route, but I would prefer to have an id returned instead when using:

```javascript
req.body.data.attributes.values.city

```

So every city should have their own id returned instead of their name.

A bit like `<option value="75">Paris</option>` in a select tag.

---

<div class="post-metadata">

**Author:** ![anon16419211](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anon16419211](https://community.forestadmin.com/u/anon16419211)\
**Post date:** [July 13, 2021, 10:10am UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893/4 "2021-07-13T10:10:20Z")

</div>

Maybe you could add the field zipcode to your smart action fields so you would be able to get zipcode (id in your case) of it, there is an [example in our documentation](https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions#change-your-forms-data-based-on-previous-field-values) that could help you to achieve it.

Let me know if it helps,  
Louis

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [July 13, 2021, 10:17am UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893/5 "2021-07-13T10:17:22Z")

</div>

I saw that example, but in my use case, it’s not really what I’m looking for as this smart action will have around 15+ different enums fields with an id attached to each choice… Is it possible to achieve this using a smart collection with static data from json?

---

<div class="post-metadata">

**Author:** ![Sliman\_Medini](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/sliman_medini/32/19_2.png) [@Sliman\_Medini](https://community.forestadmin.com/u/Sliman_Medini)\
**Post date:** [July 13, 2021, 1:19pm UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893/6 "2021-07-13T13:19:29Z")

</div>

> [@Simon\_BRAMI1](#):
>
> Is it possible to have a different returned value than the one displayed in Enums for smart actions?

Hi @Simon_BRAMI1,

Today the value and the label are the same in enum defined in smart actions.  
I’ve just created a feature request in order to support this.

Regards

---

<div class="post-metadata">

**Author:** ![Simon\_BRAMI1](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/simon_brami1/32/2753_2.png) [@Simon\_BRAMI1](https://community.forestadmin.com/u/Simon_BRAMI1)\
**Post date:** [July 13, 2021, 1:34pm UTC](https://community.forestadmin.com/t/smart-actions-enums-with-different-returned-value/2893/7 "2021-07-13T13:34:16Z")

</div>

Ok thanks!

Then as a workaround to this, I will be creating dictionaries to match the corresponding value based on a string.

```javascript
const cityType = {
  "Paris": 75,
  "Bordeaux": 33
  ...
}

....
....

let cityId = cityType[req.body.data.attributes.values.city]

```

It’s a bit tedious, but it’ll work out!

Thanks 🙂
