HubSpot: Difference between revisions
Jkuehlthau (talk | contribs) No edit summary |
Jkuehlthau (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
=Date | =Date Fields= | ||
Using API v3, | While the HubSpot API documentation states that you should pass Dates to the HubSpot API in Unix format, https://legacydocs.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis, the Starfish HubSpot connector will do this conversion for you. You do need to be sure to pass that date in a specific format and at midnight. See the following examples. | ||
Using API v3, for a date only field, you need to explicitly set the date to midnight UTC | |||
<syntaxhighlight lang="vb"> | <syntaxhighlight lang="vb"> | ||
Function ScriptedField | Function ScriptedField | ||
ScriptedField=FormatDate("@@ORG:date_entered@@", "yyyy-MM-ddT00:00:00Z") | ScriptedField=FormatDate("@@ORG:date_entered@@", "yyyy-MM-ddT00:00:00Z") | ||
End Function | End Function | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="csharp"> | |||
object ScriptedField() | |||
{ | |||
string strDte = ConvertObj2String(Starfish.OriginData["INVOICE_SENT_DATE_C"]); | |||
if (!string.IsNullOrEmpty(strDte)) | |||
{ | |||
DateTime dte = Convert.ToDateTime(strDte); | |||
strDte = dte.ToString("yyyy-MM-dd 00:00:00Z"); | |||
} | |||
return strDte; | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=Updating Contacts= | =Updating Contacts= | ||
When updating contacts, if you are matching on email address, you must be sure NOT to pass in a blank email address. HubSpot will not know which contact to update and will update a random contact with incorrect data. You can either exclude blank emails from your origin or check the "Skip if Blank" checkbox on the email address field. I prefer to do both. | When updating contacts, if you are matching on email address, you must be sure NOT to pass in a blank email address. HubSpot will not know which contact to update and will update a random contact with incorrect data. You can either exclude blank emails from your origin or check the "Skip if Blank" checkbox on the email address field. I prefer to do both. |
Revision as of 00:40, 27 January 2023
Date Fields
While the HubSpot API documentation states that you should pass Dates to the HubSpot API in Unix format, https://legacydocs.hubspot.com/docs/faq/how-should-timestamps-be-formatted-for-hubspots-apis, the Starfish HubSpot connector will do this conversion for you. You do need to be sure to pass that date in a specific format and at midnight. See the following examples.
Using API v3, for a date only field, you need to explicitly set the date to midnight UTC
Function ScriptedField ScriptedField=FormatDate("@@ORG:date_entered@@", "yyyy-MM-ddT00:00:00Z") End Function
object ScriptedField() { string strDte = ConvertObj2String(Starfish.OriginData["INVOICE_SENT_DATE_C"]); if (!string.IsNullOrEmpty(strDte)) { DateTime dte = Convert.ToDateTime(strDte); strDte = dte.ToString("yyyy-MM-dd 00:00:00Z"); } return strDte; }
Updating Contacts
When updating contacts, if you are matching on email address, you must be sure NOT to pass in a blank email address. HubSpot will not know which contact to update and will update a random contact with incorrect data. You can either exclude blank emails from your origin or check the "Skip if Blank" checkbox on the email address field. I prefer to do both.