HubSpot / hubspot-api-php

HubSpot API PHP Client Libraries for V3 version of the API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contact custom properties seem to be missing

Fedduh opened this issue · comments

commented

Hi,

For getting a contact, we also specify which custom properties te get for this contact. We have used the example code in this repo for that. This used to work. But since a while the requested properties return empty, even though they have values for this customer in Hubspot.

Did something change in this? Is anyone else experiencing this?

$searchRequest->setProperties(['custom_a', 'custom_b']);
The search result does include these fields. But their values are empty.
(I've verified that custom_a and custom_b are the internal unique names in Hubspot)

	public function getContact($email)
	{
		$filter = new \HubSpot\Client\Crm\Contacts\Model\Filter();

		$filter
			->setOperator('EQ')
			->setPropertyName('email')
			->setValue($email);

		$filterGroup = new \HubSpot\Client\Crm\Contacts\Model\FilterGroup();
		$filterGroup->setFilters([$filter]);

		$searchRequest = new \HubSpot\Client\Crm\Contacts\Model\PublicObjectSearchRequest();
		$searchRequest->setFilterGroups([$filterGroup]);
		$searchRequest->setProperties(['custom_a', 'custom_b']);

		try {
			$contactsPage = json_decode($this->hubSpot->crm()->contacts()->searchApi()->doSearch($searchRequest));
		} catch (\Throwable $t) {
			return false;
		}

		if ($contactsPage->total === 0) {
			return false;
		}

		return $contactsPage->results;
	}

PHP 7.0.33
"hubspot/api-client": "2.8.1",