# Creating standard field in entity that "Self References" that entity?

**URL:** <https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076>\
**Category:** Get Help\
**Created:** [April 12, 2024, 12:55pm UTC](https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076 "2024-04-12T12:55:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![interr0bangr](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/interr0bangr/32/8089_2.png) [@interr0bangr](https://community.fibery.io/u/interr0bangr)\
**Post date:** [April 12, 2024, 12:55pm UTC](https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076/1 "2024-04-12T12:55:37Z")

</div>

To get around the current limitations of auto-relations and not having formulas in filters, I’m trying to create a formula field that will just self-reference the entity it’s associated to.

I was hoping to just be able to use the [This Entity] field in the formula, but it only seems to work inside of a filter function.

Also, because formulas can only reference fields related to the entity they’re in, and not all the databases in Fibery, I can’t just do:

```auto
Filter([Public Id] = [This Entity].[Public Id])
  .Sort()
  .First()

```

I know I can do this by referencing the other relations that an entity may have, but I’m trying to create a standard field I can easily add to all databases that doesn’t need to be customized each time.

Is there any clean and simple way to do this?

---

<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 12, 2024, 12:59pm UTC](https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076/2 "2024-04-12T12:59:53Z")

</div>

> [@interr0bangr](#):
>
> create a formula field that will just self-reference the entity it’s associated to

Not sure I get what you want to achieve.  
Do you want to have a field in an entity, which returns the entity itself?  
Why?

---

<div class="post-metadata">

**Author:** ![interr0bangr](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/interr0bangr/32/8089_2.png) [@interr0bangr](https://community.fibery.io/u/interr0bangr)\
**Post date:** [April 12, 2024, 4:13pm UTC](https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076/3 "2024-04-12T16:13:42Z")

</div>

> [@Chr1sG](#):
>
> Do you want to have a field in an entity, which returns the entity itself?

Exactly!

> [@Chr1sG](#):
>
> Why?

There’s several Fibery limitations I’m trying to work around:  
1a. Not having any way to have filtering/conditional logic when auto-linking  
1b. Not being able to auto-link using many-to-many fields  
2a. Not having formulas in filters. Specifically automation filters in this case.  
2b. Not having branching logic in automation rules.

Maybe if I knew how to script things, it would make things easier for me, but I don’t so I have to rely on more traditional methods like formulas and automations which get very exhaustive to build and maintain.

Here’s a common scenario that we struggle to handle without having many, many separate automations that can be complex and sometimes unreliable. Using a self referencing field, I’ve been able to simplify everything into a single automation now, which is awesome, and now I’m trying to scale that approach to be able to streamline many other automations I have as well.

Relational Hierarchy:  
[Iteration] M-M [Sprint]  
[Iteration] M-M [Team]  
[Team] 1-M [Sprint]

Ideal Logic:  
WHEN  
[Iteration].[Week Number] = [Sprint].[Week Number]  
AND  
[Iteration].[Year] = [Sprint].[Year]  
AND  
[Iteration].[Teams] is any of [Sprint].[Team] (Team A, for example)  
LINK  
[Iteration] to Team A’s [Sprint]

and if any of the conditions are no longer met, UNLINK the iteration from the sprint.

You helped me with a similar scenario in another thread before if it seems familiar [Contains equivalent? - #12 by Chr1sG](https://community.fibery.io/t/contains-equivalent/3625/12)

---

<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 12, 2024, 4:36pm UTC](https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076/4 "2024-04-12T16:36:37Z")

</div>

If Iteration M-M Team and Sprint M-1 Team then I don’t understand what

> [@interr0bangr](#):
>
> [Iteration].[Teams] is any of [Sprint].[Team]

can mean.

Do you mean Iteration.Teams contains Sprint.Team?

---

<div class="post-metadata">

**Author:** ![interr0bangr](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/interr0bangr/32/8089_2.png) [@interr0bangr](https://community.fibery.io/u/interr0bangr)\
**Post date:** [April 12, 2024, 4:59pm UTC](https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076/5 "2024-04-12T16:59:59Z")

</div>

Yeah, contains is what I meant.

An iteration could have Team A and Team B working on it, so in that case it would need to show up in both the Team A Sprint and the Team B Sprint.

In the case only 1 team is working on a particular iteration, it would only be linked to the sprint for that team, for that time period.

---

<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 12, 2024, 7:13pm UTC](https://community.fibery.io/t/creating-standard-field-in-entity-that-self-references-that-entity/6076/6 "2024-04-12T19:13:41Z")

</div>

If I understand it correctly, here’s how you can do it:

Use an auto-relation to link Iterations to Sprints based on them having matching Week and Year (a.k.a. simultaneous):

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/9/9fa6e0eac104d0aea9e938fa0f815b1b5ed833be.png)

Add a formula on the Iteration db to get a list of its Team IDs:  
`Teams.Join("[" + [Public Id] + "]", " ")`

Now you can use a formula on the Iteration db to find which of the simultaneous Sprints are owned by a Team whose ID is in the Team ID list:

`[Simultaneous Sprints].Filter(Find([This Iteration].[Team IDs], "[" + Team.[Public Id] + "]") > 0)`

And you can do the opposite on the Sprint db:

`[Simultaneous Iterations].Filter(Find([Team IDs],"["+[This Sprint].Team.[Public Id]+"]")>0)`

Did I get anywhere close?
