# How to use "distinct " operator within crm\_objects function

**URL:** <https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141>\
**Category:** CMS Development\
**Created:** [July 26, 2023, 5:20am UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141 "2023-07-26T05:20:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ACarrillo7](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@ACarrillo7](https://community.hubspot.com/u/ACarrillo7)\
**Post date:** [July 26, 2023, 5:20am UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141/1 "2023-07-26T05:20:37Z")

</div>

I have been trying to use “distinct” operator but not success.

The docs say this:

--------------------------------------------------------------------------------

 ![ACarrillo7_0-1690348825656.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/3/3/3317badc96105de94f9020f360fd82741c3739a0.png)

--------------------------------------------------------------------------------

But using “distinct\_\_eq” doesn’t work, some operators are outdated in these docs, so not sure if I missed simething.

Can you help me guys?

My query looks like this: crm\_object(‘object’,‘distinct\_\_eq=pleaseworkthistime’)

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [July 26, 2023, 12:19pm UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141/2 "2023-07-26T12:19:11Z")

</div>

Hello @ACarrillo7  
“distinct\_\_eq” operator is no longer supported in the HubSpot CRM API. You can use the “distinct” operator instead. You can use it with other fields, such as name, phone number, and company.

---

<div class="post-metadata">

**Author:** ![ACarrillo7](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@ACarrillo7](https://community.hubspot.com/u/ACarrillo7)\
**Post date:** [July 27, 2023, 5:06pm UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141/3 "2023-07-27T17:06:33Z")

</div>

So, you are saying I should use this:

`{% set contact = crm_objects("contact", "distinct=pleaseworkthistime") %}`

If so, I also tried and it didn’t work

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [July 27, 2023, 5:11pm UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141/4 "2023-07-27T17:11:52Z")

</div>

No, you should use the below and if there is a custom property called “distinct” or has the word “distinct” in it a contact will be returned.

```lia-code-sample
{% set contact = crm_objects("contact", "distinct__eq=pleaseworkthistime") %}

```

Can you explain more about your use case so I can help you find the best way forward?

---

<div class="post-metadata">

**Author:** ![ACarrillo7](https://avatars.discourse-cdn.com/v4/letter/a/58f4c7/32.png) [@ACarrillo7](https://community.hubspot.com/u/ACarrillo7)\
**Post date:** [July 27, 2023, 5:19pm UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141/5 "2023-07-27T17:19:13Z")

</div>

Ok, I have a custom property with a bunch of objects, this custom object has a property “country” and I want to get all the existing different values. I read the docs [HubL functions - HubSpot docs](https://developers.hubspot.com/docs/cms/hubl/functions#crm-objects) and its says that I can use “distinct” operator. Note that “distinct” is not one of the properties.

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [July 27, 2023, 5:44pm UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141/6 "2023-07-27T17:44:58Z")

</div>

Ok, can you include a screenshot of the custom property along with some of the information that it holds. You should be able to do this by navigating into settings. I just want to ensure what “type” of property it is. What object it is linked to and what sorts of values it holds. Based on this I should have enough information to figure out a solution for you.

---

<div class="post-metadata">

**Author:** ![coldrickjack](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/coldrickjack/32/6684_2.png) [@coldrickjack](https://community.hubspot.com/u/coldrickjack)\
**Post date:** [July 26, 2023, 1:57pm UTC](https://community.hubspot.com/t/how-to-use-distinct-operator-within-crm-objects-function/86141/7 "2023-07-26T13:57:21Z")

</div>

Hey @ACarrillo7,

Do you have a custom property called “distinct” within your CRM? I think that is the issue as the documentation below is basically saying that there are certain reserved keywords and if you are trying to query the CRM for a custom property that happens to include a reference to any of them you need to append \_\_eq (or whatever operator you’d like).

_Please note: when building a query, the values of range, distinct, ndistinct, and startswith are reserved keywords. To query a property that uses one of those names, you’ll need to use the following format: range\_\_eq= (rather than range=)._

So for instance when using the [crm\_object hubl function](https://developers.hubspot.com/docs/cms/hubl/functions#crm_object) you can provide an argument to query the crm for a contact matching specificed criteria. The below would return a contact whose first name is peter and output “peter” on the page.

```lia-code-sample
{% set contact = crm_object("contact", "firstname=peter") %}
{{ contact.firstname }}

```

In contrast, if we decided to query based on a custom property called “favouritecolor” we would do this and the output would be the first name of the contact with a matching value.

```lia-code-sample
{% set contact = crm_object("contact", "favourite_color=orange") %}
{{ contact.firstname }}

```

Now imagine you had a custom property called “distinct”. That is a reserved keyword so we need to do the below and it will output the contacts first name. This contact has a value of “pleaseworkthistime” within the custom property called “distinct”.

```lia-code-sample
{% set contact = crm_object("contact", "distinct__eq=pleaseworkthistime") %}
{{ contact.firstname }}

```

I hope that makes sense and is helpful! Let me know if you’ve any questions and if it’s not helpful please share a bit more about what you are trying to achieve and we can go from there 😊
