Not change property value if the property set to null or empty
SOLVE
Hey IElsanosi,
You can use a conditional statement to check if the value of $user->getJob() is not null before setting the property in the $contactInput array. Here's an example:
In this example, we first create an array with the properties we want to set, excluding the 'job' property. Then, we use a conditional statement to check if $user->getJob() is not null. If it's not null, we add the 'job' property to the array with the value of $user->getJob(). Finally, we set the properties in the $contactInput object using the updated array.
This way, if $user->getJob() returns null, the 'job' property will not be set in the $contactInput object, and the existing value of the property in HubSpot will not be overwritten.
I hope this helps, and please let me know if you have further questions.
Not change property value if the property set to null or empty
SOLVE
Hey IElsanosi,
You can use a conditional statement to check if the value of $user->getJob() is not null before setting the property in the $contactInput array. Here's an example:
In this example, we first create an array with the properties we want to set, excluding the 'job' property. Then, we use a conditional statement to check if $user->getJob() is not null. If it's not null, we add the 'job' property to the array with the value of $user->getJob(). Finally, we set the properties in the $contactInput object using the updated array.
This way, if $user->getJob() returns null, the 'job' property will not be set in the $contactInput object, and the existing value of the property in HubSpot will not be overwritten.
I hope this helps, and please let me know if you have further questions.