# If condition: how to return nothing when the returned type is an entity?

**URL:** <https://community.fibery.io/t/if-condition-how-to-return-nothing-when-the-returned-type-is-an-entity/2452>\
**Category:** Get Help\
**Tags:** formulas\
**Created:** [January 26, 2022, 7:27pm UTC](https://community.fibery.io/t/if-condition-how-to-return-nothing-when-the-returned-type-is-an-entity/2452 "2022-01-26T19:27:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Claude\_de\_Loupy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/claude_de_loupy/32/1637_2.png) [@Claude\_de\_Loupy](https://community.fibery.io/u/Claude_de_Loupy)\
**Post date:** [January 26, 2022, 7:27pm UTC](https://community.fibery.io/t/if-condition-how-to-return-nothing-when-the-returned-type-is-an-entity/2452/1 "2022-01-26T19:27:26Z")

</div>

Hi,

I am missing something? (I searched in this forum but found nothing)

The `if` function _needs_ 3 arguments. So you cannot use: `if(test, do this)`  
You must write: `if(test, do this, do that)`

If I want to do nothing, it’s easy when dealing with text: just return “” → `if(test, “test ok”, “”)´

But if the result of a test is an entity (say a Contact), what can I return? What is the equivalent of “” for an entity?  
`if(test, a_given_contact, ????)`

Thanks

---

<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:** [January 26, 2022, 11:13pm UTC](https://community.fibery.io/t/if-condition-how-to-return-nothing-when-the-returned-type-is-an-entity/2452/2 "2022-01-26T23:13:49Z")

</div>

Do you mean in a formula field or within an automation/button?

---

<div class="post-metadata">

**Author:** ![Claude\_de\_Loupy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/claude_de_loupy/32/1637_2.png) [@Claude\_de\_Loupy](https://community.fibery.io/u/Claude_de_Loupy)\
**Post date:** [January 27, 2022, 7:31am UTC](https://community.fibery.io/t/if-condition-how-to-return-nothing-when-the-returned-type-is-an-entity/2452/3 "2022-01-27T07:31:00Z")

</div>

In an automation rule.

---

<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:** [January 27, 2022, 7:57am UTC](https://community.fibery.io/t/if-condition-how-to-return-nothing-when-the-returned-type-is-an-entity/2452/4 "2022-01-27T07:57:31Z")

</div>

In that case, you could use the `filter().sort().first()` functions in such a way as to return a null/empty result.  
e.g. `Contacts.filter(Name = "").sort().first()` will give you zero contacts if all contacts have a name.

In fact, it might be possible in some cases that you could just use this formulation (with an appropriate filter condition) without needing the if condition.

---

<div class="post-metadata">

**Author:** ![Claude\_de\_Loupy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/claude_de_loupy/32/1637_2.png) [@Claude\_de\_Loupy](https://community.fibery.io/u/Claude_de_Loupy)\
**Post date:** [January 27, 2022, 10:21am UTC](https://community.fibery.io/t/if-condition-how-to-return-nothing-when-the-returned-type-is-an-entity/2452/5 "2022-01-27T10:21:43Z")

</div>

Thanks a lot Chris. It works. I understand we need a workaround here.  
I will search for a more “frugal” workaround later.

I think the if condition should accept only 2 arguments or a NULL entity should exist.

Thanks again
