# Smart relationship field shows id instead of name (not populated)

**URL:** <https://community.forestadmin.com/t/smart-relationship-field-shows-id-instead-of-name-not-populated/5887>\
**Category:** Help me!\
**Created:** [January 22, 2023, 10:28am UTC](https://community.forestadmin.com/t/smart-relationship-field-shows-id-instead-of-name-not-populated/5887 "2023-01-22T10:28:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmz](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nmz/32/4709_2.png) [@nmz](https://community.forestadmin.com/u/nmz)\
**Post date:** [January 22, 2023, 10:28am UTC](https://community.forestadmin.com/t/smart-relationship-field-shows-id-instead-of-name-not-populated/5887/1 "2023-01-22T10:28:22Z")

</div>

## Feature(s) impacted

smart field not populated correctly

## Observed behavior

the desired referenced field is not being populated

## Expected behavior

relationship field to show name of document

## Failure Logs

no failure logs

## Context

- Project name: WescoverContentAdmin
- Team name: Content Admin
- Environment name: Development | nimrodmaltz
- Agent type & version: “forest-express-mongoose”: “8.7.6”
- Recent changes made on your end if any: added smart relationship

hello again,

we’ve seen this type of behavior before: [Referenced field shows id (not populated) after migration to v8](https://community.forestadmin.com/t/referenced-field-shows-id-not-populated-after-migration-to-v8/4906)

ive created a smart belongs to relationship between two collections, it works fine, when clicked, the desired document is fetched.  
but when looking at the field in the details tab or collection tab, the field reads as an id and it should read as document name as setted in the layout editor collection settings.  
furthermore, when the target collection is cached (clicked once): the names appear.  
so i’m guessing its not populated to begin with.

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

thanks in advance,  
nimrod

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 23, 2023, 10:53am UTC](https://community.forestadmin.com/t/smart-relationship-field-shows-id-instead-of-name-not-populated/5887/2 "2023-01-23T10:53:57Z")

</div>

Hey @nmz

Do you mind sharing the smart relationship definition as well as the HTTP request sent by the frontend to retrieve this data? (As DM if you consider this to be private)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [January 24, 2023, 7:20am UTC](https://community.forestadmin.com/t/smart-relationship-field-shows-id-instead-of-name-not-populated/5887/4 "2023-01-24T07:20:01Z")

</div>

After getting the info, it seems like the issue was related to the smart field not returning the required element of the record (Here, `_id` and the reference field name) →

The previous code looked something like this

```javascript
field: 'MyField',
type: 'String',
get: async () => {
     const record = await getRecord();
     return record._id
}

```

Whereas the code required to make reference field work would look like

```javascript
field: 'MyField',
type: 'String',
get: async () => {
     const record = await getRecord();
     return record;
}

```

Seems like our documentation does not cover this case, so we’ll update it accordingly.  
I’ll mark the thread as resolved 👍

Thanks for reporting this 🙏
