# Custom reference field

**URL:** <https://community.forestadmin.com/t/custom-reference-field/1984>\
**Category:** Help me!\
**Created:** [March 2, 2021, 11:01am UTC](https://community.forestadmin.com/t/custom-reference-field/1984 "2021-03-02T11:01:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ilias\_El-mhamdi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ilias_el-mhamdi/32/1314_2.png) [@Ilias\_El-mhamdi](https://community.forestadmin.com/u/Ilias_El-mhamdi)\
**Post date:** [March 2, 2021, 11:01am UTC](https://community.forestadmin.com/t/custom-reference-field/1984/1 "2021-03-02T11:01:55Z")

</div>

Hello,

I have a json field as a Name for a table in my db.  
I would like to have a custom reference field for this field.  
Right now it’s outputing toString(name) → [object, object] as a reference display. I would like to display toString([name.FR](http://name.FR)) or at least JSON.stringify(name)

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/5/5cc187503da5dbb013467a7ce972b170da58414c.png)

Thank you for your help,  
Best,  
Ilias

---

<div class="post-metadata">

**Author:** ![Guillaume\_Cisco](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaume_cisco/32/918_2.png) [@Guillaume\_Cisco](https://community.forestadmin.com/u/Guillaume_Cisco)\
**Post date:** [March 2, 2021, 1:36pm UTC](https://community.forestadmin.com/t/custom-reference-field/1984/2 "2021-03-02T13:36:28Z")

</div>

Hello @Ilias_El-mhamdi,

I can reproduce this behaviour on my side.  
Right now, it is not possible to directly modify the displayed custom reference field.

But you can easily achieve the desired behaviour by [creating a smart field](https://docs.forestadmin.com/documentation/reference-guide/fields/create-and-manage-smart-fields#creating-a-smart-field) and setting it as your custom reference field.

For example, you can create:

```javascript
fields: [{
    field: 'displayName',
    type: 'String',
    get: (record) => {
      return Object.values(record.name)[0];
    }
  }],

```

Now bind `displayName` to the custom reference field.

 ![Capture d’écran 2021-03-02 à 14.35.44](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/6/6dc847b981ab0a56e6fa1cc6d8b5b9ddbd88ff84.png)

It will no more display `[object, object]`

Let me know if it helps 🙂

---

<div class="post-metadata">

**Author:** ![Ilias\_El-mhamdi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/ilias_el-mhamdi/32/1314_2.png) [@Ilias\_El-mhamdi](https://community.forestadmin.com/u/Ilias_El-mhamdi)\
**Post date:** [March 2, 2021, 2:23pm UTC](https://community.forestadmin.com/t/custom-reference-field/1984/3 "2021-03-02T14:23:30Z")

</div>

Thank you for your fast reply.  
It works !  
Thank you very much !  
Best,  
Ilias
