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

Now that Feed view is available I’m finally making use of Rich Text fields, and I’m creating lots of References: however I notice that References are not available as Fields in any of the collective views: I can only see them in individual Entity views. I’ve seen some comments about References being implemented as “hidden” collections: is it possible to make References (to various Databases) available so that I can display them as Collections in the individual cards comprising my Board views, Feed views, etc.?

References are not really hidden collections, but it is true that info about a reference is available using formulas and the API.

Compared with the normal relations, references are deliberately quite unstructured - you can link to or mention any entity of any database. This obviously allows for great flexibility.
There are some real technical challenges to turn references into collections (structured relations) since this would imply that every database could potentially link to every other database in the workspace.

I think there could be some benefit from exposing more information about references via formulas, but converting them to collections is very unlikely I guess.

If you need a collection, use a relationship :slightly_smiling_face:

I can see how that could be very complicated! What would be useful (for me) would be an API (ie. some methods available in formulae) that would allow me to select all the References to a particular Database and return them as a Collection. eg. if my Entity contains References to Tags and Persons, then in a formula I could say something like:

References.Restrict(TargetDataBase = Tag).Count()

ie. References (an internal list of references to potentially multiple Databases) would not be usable directly, but via its Restrict() method you could convert it into a Collection of Entities from any specific Database, and then use that Collection like you would any other Collection (in any formula).

Are you talking about extracting mentions/references from an entity (in a rich text field) or extracting the pointers to an entity (showing in the References section)?

Extracting the pointers to an entity: ie. if this entity was referenced (say) 3 times by other entities (say: Task foo, Task bar and Person bob each Referenced it), then I want to be able to extract the Collections of referring entities: Tasks (foo, bar) and Persons (bob). Currently I can see those three back-references in the Entity view (“REFERENCED 3 TIMES:”) but I can’t see them in any Board/List/Table views. So I was looking for a way to create a Collection that contains a list of referencing entities (from a given Database). Thus in my Board view I could see foo and bar show up, or bob show up (with their appropriate color schemes) as referring entities (back-references).

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:

Yes I think that would be exactly what I need: thanks!! Couple of questions:

  1. Would I create that as an Automation (Rule)?
  2. Could I use “Entity Linked to a Task” as the trigger? Or are References not considered Linked Entities?
  3. How do I enter the script as the Action?
  1. I think that makes sense.
  2. No, they don’t count and won’t trigger this. I suggest either running on a schedule, or creating a formula field that counts the number of references, and trigger on when it changes.
  3. You can just choose Script as one of the possible actions.

Good grief: I totally missed the “Script” action! Sorry and thanks again: I’ll give it a try!