# New agent legacy - smartfield

**URL:** <https://community.forestadmin.com/t/new-agent-legacy-smartfield/6733>\
**Category:** Help me!\
**Tags:** howtos, setup, smart-view\
**Created:** [October 6, 2023, 8:58am UTC](https://community.forestadmin.com/t/new-agent-legacy-smartfield/6733 "2023-10-06T08:58:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nadiab](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nadiab/32/1812_2.png) [@nadiab](https://community.forestadmin.com/u/nadiab)\
**Post date:** [October 6, 2023, 8:58am UTC](https://community.forestadmin.com/t/new-agent-legacy-smartfield/6733/1 "2023-10-06T08:58:20Z")

</div>

Hello,

We’ve migrate to the new legacy agent & we’ve a question regarding smartfields.  
Is there a shorter way to create smartfields from a relationship without creating each one on index.js.

We’ve the following relationship between “users” & “beneficiaries” tables/models :

```javascript
        user.hasOne(beneficiary, {
            foreignKey: "fk_userId",
        });

```

The “fk\_userId” appears on Visual builder \> Fields.  
We’ve drag & dropped the “fk\_userId” field in the smartview & the id links us to the correct user (table users).  
Is it possible to access user’s data through fk\_userId without declaring each fileds, getValues… on the index.js please ?

## Context

- Project name: Nostrum Care v3
- Team name: Op
- Environment name: development
- Agent (forest package) name & version:  
“@forestadmin/agent”: “^1.0.0”,  
“@forestadmin/datasource-sequelize”: “^1.5.21”,  
“@forestadmin/datasource-sql”: “^1.0.0”,  
“dotenv”: “^16.0.1”,  
“pg”: “^8.8.0”,  
“sequelize”: “^6.33.0”
- Database type: Postgresql
- Recent changes made on your end if any: …

---

<div class="post-metadata">

**Author:** ![nadiab](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/nadiab/32/1812_2.png) [@nadiab](https://community.forestadmin.com/u/nadiab)\
**Post date:** [October 6, 2023, 9:03am UTC](https://community.forestadmin.com/t/new-agent-legacy-smartfield/6733/2 "2023-10-06T09:03:12Z")

</div>

Or is there a way to create multiple smartfields from one getValues on the user please ?

---

<div class="post-metadata">

**Author:** ![Florian\_Gonzales](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/florian_gonzales/32/5541_2.png) [@Florian\_Gonzales](https://community.forestadmin.com/u/Florian_Gonzales)\
**Post date:** [October 6, 2023, 1:50pm UTC](https://community.forestadmin.com/t/new-agent-legacy-smartfield/6733/3 "2023-10-06T13:50:43Z")

</div>

Hello @nadiab 👋

I’m having a bit of trouble understanding your need 🤔, could you elaborate a bit more? Maybe an example or a screenshot would help. 🙏 🙂

Kind regards,

Florian
