APIs & Integrations

IG1
Member

search by hs_searchable_calculated fields

SOLVE

Hello, i'm trying to search for companies by phone, that doesn't have standard view (1 800 555 3535, 1 800 555 35 35, 1800 555 3535). I found `hs_searchable_calculated_*`, but all claculated_props from hubspot-props doesn't work with companies, although with contacts it works fine. Is there any other way to properly find a company by phone on hubspot side. Way with adding a lot of phone variation to filterGroups looks not good. Thank you and sorry for bad english 🙂

// POST https://api.hubapi.com/crm/v3/objects/contacts/search
{
  "limit": 1,
  "sorts": [
    {
      "propertyName": "createdate",
      "direction": "DESCENDING"
    }
  ],
  "properties": [
    "email",
    "phone",
    "firstname",
    "lastname",
    "createdate"
  ],
  "filterGroups": [
    {
      "filters": [
        {
          "value": "18005554545",
          "propertyName": "hs_searchable_calculated_phone_number",
          "operator": "CONTAINS_TOKEN"
        }
      ]
    }
  ]
}

 

0 Upvotes
1 Accepted solution
jpsanchez
Solution
Contributor | Elite Partner
Contributor | Elite Partner

search by hs_searchable_calculated fields

SOLVE

Hi, 

 

Not sure about your sentence. ..
What i have in mind. 

 

1.- Create in Hubspot a new property. Name it as you wish to. In the creation process check the box related to i want this property to be searchable.. bla bla.

 

2.- Create a Workflow. Name it as you wish to. This WF will start when the original property from Company/phone is know. Next will copy the content to the new property you create in step 1. 
END---

3.- PRODUCTION USE.- changes to do. 

 

Add the new property name in the "properties": bla bla bla...

 

Modify Filter Group by adding the new property create it in step 1. 
( i paste again your code here in order to be more readeable.)

 

Final point. You don´t have to create each time a property as you mention, not sure what do you mean, if you could please give more details will be great!

Best.

 

 

// POST https://api.hubapi.com/crm/v3/objects/contacts/search
{
  "limit": 1,
  "sorts": [
    {
      "propertyName": "createdate",
      "direction": "DESCENDING"
    }
  ],
  "properties": [
    "email",
    "phone",
    "firstname",
    "lastname",
    "createdate"
  ],
  "filterGroups": [
    {
      "filters": [
        {
          "value": "18005554545",
          "propertyName": "hs_searchable_calculated_phone_number",
          "operator": "CONTAINS_TOKEN"
        }
      ]
    }
  ]
}

 

 

View solution in original post

6 Replies 6
jpsanchez
Contributor | Elite Partner
Contributor | Elite Partner

search by hs_searchable_calculated fields

SOLVE

Hi, 

I guess a walk arround will work. (/ this happen with other properties in objects) 

Create a new Company/property that mirrows the Company/phone. ( that can be done with a workflow)

 

Select for search this new property. 

It should work. 

Best

JP

 

0 Upvotes
RomanGruit
Top Contributor

search by hs_searchable_calculated fields

SOLVE

Hi @IG1,

The first that comes to my mind is to create the hs_searchable_calculated_phone_number field for companies. 
Just run through every company record and create hs_searchable_calculated_phone_number based on the existing phone field. Does it make sense for you? 

0 Upvotes
IG1
Member

search by hs_searchable_calculated fields

SOLVE

can't create a property with this name - `A property with the internal name "hs_searchable_calculated_phone_number" already exists or is restricted.`

0 Upvotes
IG1
Member

search by hs_searchable_calculated fields

SOLVE

there is also a problem with adding new fields - I need to add this field every time a new company is created. I think keeping it synchronized is quite difficult

0 Upvotes
jpsanchez
Solution
Contributor | Elite Partner
Contributor | Elite Partner

search by hs_searchable_calculated fields

SOLVE

Hi, 

 

Not sure about your sentence. ..
What i have in mind. 

 

1.- Create in Hubspot a new property. Name it as you wish to. In the creation process check the box related to i want this property to be searchable.. bla bla.

 

2.- Create a Workflow. Name it as you wish to. This WF will start when the original property from Company/phone is know. Next will copy the content to the new property you create in step 1. 
END---

3.- PRODUCTION USE.- changes to do. 

 

Add the new property name in the "properties": bla bla bla...

 

Modify Filter Group by adding the new property create it in step 1. 
( i paste again your code here in order to be more readeable.)

 

Final point. You don´t have to create each time a property as you mention, not sure what do you mean, if you could please give more details will be great!

Best.

 

 

// POST https://api.hubapi.com/crm/v3/objects/contacts/search
{
  "limit": 1,
  "sorts": [
    {
      "propertyName": "createdate",
      "direction": "DESCENDING"
    }
  ],
  "properties": [
    "email",
    "phone",
    "firstname",
    "lastname",
    "createdate"
  ],
  "filterGroups": [
    {
      "filters": [
        {
          "value": "18005554545",
          "propertyName": "hs_searchable_calculated_phone_number",
          "operator": "CONTAINS_TOKEN"
        }
      ]
    }
  ]
}

 

 

Jaycee_Lewis
Community Manager
Community Manager

search by hs_searchable_calculated fields

SOLVE

Hi, @IG1! Thank you for taking the time to give context to your issue and for including your code example. Hey, @RMones @RomanGruit @jpsanchez do you have any insight or next steps for @IG1?

Thank you! – Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot