In a Typescript Repo I would like to query the Comments of an Object:
Developer Assist was recommending me this, but I guess this package does not really exist?
import { Comments } from '@foundry/ui-components';
// Assuming you have the object RID
const objectRid = 'ri.your.object.rid';
// Get the comments for the object
const comments = await Comments.getComments(objectRid);
Therefore how do I query the Comments via Typescript?
Hi @emmanuel1, as far as I know it’s not possible to capture those comments using a TS function because they are not recorded to the ontology, as per the documentation here:
Example 1: Using the Comments Widget is only saved within that specific Object View, and does not write back to the actual object. If these comments might be useful outside the context of the specific object, consider using Actions to capture them.
In my experience, I’ve always rolled my own Comment object type and either built my own (using object list and text boxes) comments panel for the object view in Workshop or used the Workshop Comments widget. The latter is a bit finicky to get set up as, at least the last time I used it, it involved getting the schema on your comments object jusssstttt right, but it does unlock some nice functionality “for free” on the UI side while also spitting out comments-as-data objects that you can easily work with in Typescript.
This doesn’t help with an existing set of comments that users have already made directly on objects, but hopefully helps for future solution design.