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:
<%
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
1 Like
Hi, Julien!
Views are not stored in any database, they are a separate resource. Please take a look at Fibery API 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:
filter: {type: "entity", typeId: dbID, id: entityID}
What will remain is to extract “fibery/id” values from the returned list.
Hope this helps!
1 Like