# Getting all field values for an entity

**URL:** <https://community.fibery.io/t/getting-all-field-values-for-an-entity/2801>\
**Category:** API & Programming\
**Tags:** flexible-domain, automations\
**Created:** [May 14, 2022, 5:18pm UTC](https://community.fibery.io/t/getting-all-field-values-for-an-entity/2801 "2022-05-14T17:18:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [May 14, 2022, 5:18pm UTC](https://community.fibery.io/t/getting-all-field-values-for-an-entity/2801/1 "2022-05-14T17:18:51Z")

</div>

Here’s a little scripting snippet for how to retrieve all the information about an entity, without knowing or hard-coding the space name, database name or field names:

```auto
const fibery = context.getService('fibery');
// get entire schema
const schema = await fibery.getSchema();
// get specific database (type) name
const typeName = args.currentEntities[0].type;
// filter the schema for the specific type and get all field names
const fields = schema['typeObjects'].filter((obj) => obj.name == typeName)[0]['fieldObjects'].map((field) => field.name);
// get all entities with all fields
const entitiesWithAllFields = await fibery.getEntitiesByIds(typeName, args.currentEntities.map((entity) => entity.id), fields);
// send result to the browser console
console.log(entitiesWithAllFields);

```

---

<div class="post-metadata">

**Author:** ![Yuri\_BC](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/yuri_bc/32/8803_2.png) [@Yuri\_BC](https://community.fibery.io/u/Yuri_BC)\
**Post date:** [March 19, 2024, 3:27pm UTC](https://community.fibery.io/t/getting-all-field-values-for-an-entity/2801/2 "2024-03-19T15:27:05Z")

</div>

Your exact script has as output for me, when applied to the current entity of database ‘CCE Root/Page’:

Failed to execute Action “Script”: getEntitiesByIds: There is no relation for ‘CCE Root/Page’ database whiteboards/whiteboards field.

---

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [March 19, 2024, 9:36pm UTC](https://community.fibery.io/t/getting-all-field-values-for-an-entity/2801/3 "2024-03-19T21:36:48Z")

</div>

Yeah, it seems that it won’t work if the Whiteboards or Documents field is enabled (whiteboards and documents are technically views, so you can’t query them like you can for fields and relations).

To avoid the issue, I suggest using replacing this

`const entitiesWithAllFields = await fibery.getEntitiesByIds(typeName, args.currentEntities.map((entity) => entity.id), fields);`

with this

`const entitiesWithAllFields = await fibery.getEntitiesByIds(typeName, args.currentEntities.map((entity) => entity.id), fields.filter((f)=> f !== 'whiteboards/whiteboards' && f !== 'documents/documents'));`

---

<div class="post-metadata">

**Author:** ![Renato\_Carvalho](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/renato_carvalho/32/11001_2.png) [@Renato\_Carvalho](https://community.fibery.io/u/Renato_Carvalho)\
**Post date:** [January 31, 2025, 6:02pm UTC](https://community.fibery.io/t/getting-all-field-values-for-an-entity/2801/4 "2025-01-31T18:02:34Z")

</div>

Just found this thread because a script that was working all fine stopped working.

Just because I added a Whiteboard linked document to a database.

`Failed to execute Action "Script": getEntityById: There is no relation for "Database/Oportunidades" database "whiteboards/whiteboards" field.`
