# Link to one of 2 possible entities

**URL:** <https://community.fibery.io/t/link-to-one-of-2-possible-entities/3694>\
**Category:** Get Help\
**Created:** [December 12, 2022, 12:06pm UTC](https://community.fibery.io/t/link-to-one-of-2-possible-entities/3694 "2022-12-12T12:06:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marloes](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/marloes/32/5926_2.png) [@Marloes](https://community.fibery.io/u/Marloes)\
**Post date:** [December 12, 2022, 12:06pm UTC](https://community.fibery.io/t/link-to-one-of-2-possible-entities/3694/1 "2022-12-12T12:06:33Z")

</div>

When an order is created we automatically link an order (via automation) to a contact. Or, if contact does not excist, we create a new contact.

We check whether or not the contact excist by checking if the emailadress is already used by one of the excisting contacts. Therefor we use this formula:

[Contacts (Database)].Filter([E-mail] = [Step 1 Order].[E-mail]).Sort().First()

But our contacts can have up to 2 emailadresses. So therefore we have 2 fields (_E-mail_ and _2e E-  
mailadres_). Is there a way to check in both fields to see if in one of those fields the emailadress already excists.

I thought something like below, but that was probably thought to easy ;-).

[Contacts (Database)].Filter([E-mail] **or [2e E-mailadres]** = [Step 1 Order].[E-mail]).Sort().First()

@YvetteLans FYI

---

<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:** [December 12, 2022, 12:38pm UTC](https://community.fibery.io/t/link-to-one-of-2-possible-entities/3694/2 "2022-12-12T12:38:39Z")

</div>

`[Contacts (Database)].Filter([E-mail] = [Step 1 Order].[E-mail] OR [2e E-mailadres] = [Step 1 Order].[E-mail]).Sort().First()`

You need to OR two conditions, rather than OR’ing the two email addresses 🙂
