(How) can I display References in my Board and Feed views?

If you create relations between the relevant databases, then something like the following script will populate them with referring entities:

const fibery = context.getService('fibery');
for (const entity of args.currentEntities) {
    const entityWithRefs = await fibery.getEntityById(entity.type, entity.id, ["References"]);

    for (const ref of entityWithRefs["References"]) {
        const refdoc = await fibery.getEntityById("Collaboration~Documents/Reference", ref["Id"], ["FromEntityId"]);

        const refentity = await fibery.getEntityById("SPACE/Task", refdoc["FromEntityId"], ["Name"]);
        if (refentity != null) {
            await fibery.addCollectionItem(entity.type, entity.id, "Name of field linking to Task", refentity['Id']);
        }

        const refentity = await fibery.getEntityById("SPACE/Person", refdoc["FromEntityId"], ["Name"]);
        if (refentity != null) {
            await fibery.addCollectionItem(entity.type, entity.id, "Name of field linking to Person", refentity['Id']);
        }
    }
}

In other words, if the entity is a Meeting, you can create many-to-many relations between Meeting and Task databases and between Meeting and Person databases.
Then running the above script will populate these relations with [foo, bar] and [bob] respectively.

It’s up to you how you want to trigger this script - it could be on a button press, on an hourly schedule, when a formula field changes e.g. References.Count()

Hope this is helpful :slight_smile:

2 Likes