# hubspot update

**URL:** <https://community.hubspot.com/t/hubspot-update/76205>\
**Category:** APIs & Integrations\
**Tags:** starter\
**Created:** [March 1, 2023, 12:17am UTC](https://community.hubspot.com/t/hubspot-update/76205 "2023-03-01T00:17:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AShrestha9](https://avatars.discourse-cdn.com/v4/letter/a/f4b2a3/32.png) [@AShrestha9](https://community.hubspot.com/u/AShrestha9)\
**Post date:** [March 1, 2023, 12:17am UTC](https://community.hubspot.com/t/hubspot-update/76205/1 "2023-03-01T00:17:19Z")

</div>

Hi guys I am new to hubspot and still in learning phase.I am encounteringa problem when I add update function to my crud operation the some of the contacts donot get created(ie not inserted into database). It is taking first two contacts however i have to wait while to add another.However if I remove the update function, there is no problem in create.My code is posted below:

case self::CONTACT\_CREATION:

Log::info(“WebhookController.SwitchCase@CONTACT\_CREATION”, [“event”=\> $event, “integration”=\>$integration]);

//Get contact details form HB using object-id from webhook event

$contact = $integration-\>getContact($event-\>objectId)-\>getProperties();

Log::info(‘hs\_contact’, [‘hs\_contact’ =\> $contact]);

//Save contact to database

Contact::create([

‘hs\_contact\_id’ =\> $contact[‘hs\_object\_id’],

//include other columns as well.

‘contact\_name’ =\> $contact[‘firstname’].’ '.$contact[‘lastname’],

‘contact\_email’ =\> $contact[‘email’],

‘contact\_phone’ =\> $contact[‘phone’],

]);

break;

case self::CONTACT\_PROPERTY\_CHANGE:

if ( Contact::where(‘hs\_contact\_id’, $event-\>objectId)-\>exists())

{

$contactdbId= $event-\>objectId;

$contactdb = Contact::where([[‘hs\_contact\_id’, $contactdbId]])-\>first();

Log::info(‘contact’, [‘contact’ =\> $contactdb]);

if ($event-\>propertyName ==‘phone’)

{

$contactdb-\>contact\_phone=$event-\>propertyValue;

$contactdb-\>save();

}

if ( $event-\>propertyName === ‘firstname’)

{

$contactdb-\>contact\_name=$event-\>propertyValue;

$contactdb-\>save();

}

if ( $event-\>propertyName === ‘email’)

{

$contactdb-\>contact\_email=$event-\>propertyValue;

$contactdb-\>save();

}

}

else

{

return true;

}
