# Automate linking between referenced entities

**URL:** <https://community.fibery.io/t/automate-linking-between-referenced-entities/2753>\
**Category:** API & Programming\
**Created:** [April 29, 2022, 6:06am UTC](https://community.fibery.io/t/automate-linking-between-referenced-entities/2753 "2022-04-29T06:06:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)\
**Post date:** [April 29, 2022, 6:33am UTC](https://community.fibery.io/t/automate-linking-between-referenced-entities/2753/2 "2022-04-29T06:33:39Z")

</div>

Is it correctly understood that you would like to auto-link an entity to any other entity that mentions/refers to it?

conversations mention/refer to insights  
insights ↔ conversations (many-to-many relation) to be linked whenever a mention occurs

It is possible using a script in an automation rule, see here:

> [@(How) can I display References in my Board and Feed views?](https://community.fibery.io/t/how-can-i-display-references-in-my-board-and-feed-views/2505/6):
>
> 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"]); …

and here:

> [@Make "creation context" available to scripts](https://community.fibery.io/t/make-creation-context-available-to-scripts/2385):
>
> Scenario: I am typing notes in the richtext Description field of a “Meeting Notes” entity. When I create a new Task entity inline (via Ctrl+E), and I want a script to automatically set some fields in the new Task entity upon creation, and it has existing relations that are relevant. But the script needs to know the context in which this new Task entity is created – i.e., this “Meeting Notes” entity is a kind of “parent context” for its creation. The script needs this parent-context to get the…

---

_[View the full topic](https://community.fibery.io/t/automate-linking-between-referenced-entities/2753)._
