# Get database id of a view in a Smart Folder

**URL:** <https://community.fibery.io/t/get-database-id-of-a-view-in-a-smart-folder/4171>\
**Category:** Get Help\
**Created:** [March 22, 2023, 1:46pm UTC](https://community.fibery.io/t/get-database-id-of-a-view-in-a-smart-folder/4171 "2023-03-22T13:46:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![julien.erny](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/julien.erny/32/5833_2.png) [@julien.erny](https://community.fibery.io/u/julien.erny)\
**Post date:** [March 22, 2023, 1:46pm UTC](https://community.fibery.io/t/get-database-id-of-a-view-in-a-smart-folder/4171/1 "2023-03-22T13:46:51Z")

</div>

Hi,

I would like to insert a reference to a View from a Smart Folder in a Rich-Text field via an OnCreate automation.  
How do I get the database ID and the view’s UUID?  
I’m looking for an equivalent to this for views:

```auto
<%
const fibery = context.getService('fibery');
const schema = await fibery.getSchema();
const dbID = schema['typeObjects'].filter((obj) => obj.name == 'Space/DBname')[0]['id'];
%>

```

Thanks a lot

---

<div class="post-metadata">

**Author:** ![AlexeyLiplyanin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/alexeyliplyanin/32/6432_2.png) [@AlexeyLiplyanin](https://community.fibery.io/u/AlexeyLiplyanin)\
**Post date:** [March 22, 2023, 2:45pm UTC](https://community.fibery.io/t/get-database-id-of-a-view-in-a-smart-folder/4171/2 "2023-03-22T14:45:30Z")

</div>

Hi, Julien!

Views are not stored in any database, they are a separate resource. Please take a look at [Fibery API](https://api.fibery.io/#view) for some examples on how to work with them.

I’m not sure I understood where smartfolders fit in your case. But in order to get the views that are attached to an entity inside a smart folder (there may be many of them) try this filter for the “query-views” call:

```auto
filter: {type: "entity", typeId: dbID, id: entityID}

```

What will remain is to extract “fibery/id” values from the returned list.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![julien.erny](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/julien.erny/32/5833_2.png) [@julien.erny](https://community.fibery.io/u/julien.erny)\
**Post date:** [March 22, 2023, 2:47pm UTC](https://community.fibery.io/t/get-database-id-of-a-view-in-a-smart-folder/4171/3 "2023-03-22T14:47:36Z")

</div>

Thanks! I’ll try that 🙏
