I’m just trying to figure out how to retrieve the secret for a Documents collection.
This is not working - always gets null:
1 Like
Not sure if this is what you are looking for
for (const entity of args.currentEntities) {
const [assignees, summary] = await Promise.all([
getAssigneesSlackIds(entity.type, entity.id),
api.getDocumentContent(entity["Summary"].secret)
]);
taken from Fibery GitLab
@Matt_Blais The construction you have used would work fine for rich text fields, but the Documents collection works slightly differently.
It returns an array of ‘views’ and you need to look at the meta data for each of them to get the document secret.
The syntax should be something like this:
const doc0 = entity['Documents'][0];
const docView = await fibery.getEntityById('fibery/view', doc0.id, ['fibery/meta']);
const docSecret = docView['fibery/meta']['documentSecret'];
2 Likes