APIs & Integrations

FrankYu
Teilnehmer/-in

Support for a One-to-Many mapping for a Contact Property not restricted to a list of allowed values

lösung

We want a Contact to have a property "subjects" that will contain a list of subjects they the Contact is interested in, (i.e. Accounting, Computer Graphics, Product Design, etc.). The list of allowed values for "subjects" is about 300 items long and constantly updating, so it doesn't seem feasible to use an "enumeration" data type to represent it. The only solution I see is to save the value as multi-line text, where each line represents a "subject" they are interested in.

 

Is there a better way to accomplish this One-to-Many mapping?

0 Upvotes
1 Akzeptierte Lösung
jackcoldrick
Lösung
HubSpot Employee
HubSpot Employee

Support for a One-to-Many mapping for a Contact Property not restricted to a list of allowed values

lösung

Hi @FrankYu,

 

This is a common issue I've seen come up over the past few years. The multi-line text field approach is probably your best bet if the data is constantly changing. You could create a custom property called "Subjects" and ensure it is set as a "multi-line text" property. You could then "create or update a contact" and pass values as shown below:

 

{
  "properties": [
    {
      "property": "email",
      "value": "testcontact001@hubspot.com"
    },
    {
      "property": "firstname",
      "value": "Jack"
    },
    {
      "property": "subjects",
      "value": "Option 1, Option 2, Option 3, Option 4"
    }
 ] 
}

Once the data is passed to HubSpot you would then be free to segment using lists or enroll into workflows based on the data contained in this property.

 

Be mindful that if you choose to move forward with the above option if you pass a new value in to the "subjects" property  at a later stage it won't be appended. It will replace all existing values.  Therefore you'd need to ensure you pass through a request like this in order to update a contact accordingly:

 

{
  "properties": [
    {
      "property": "subjects",
      "value": "Option 1, Option 2, Option 3, Option 4, New Subject Here"
    }
 ] 
}

I hope this helps,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn

Lösung in ursprünglichem Beitrag anzeigen

3 Antworten
jackcoldrick
Lösung
HubSpot Employee
HubSpot Employee

Support for a One-to-Many mapping for a Contact Property not restricted to a list of allowed values

lösung

Hi @FrankYu,

 

This is a common issue I've seen come up over the past few years. The multi-line text field approach is probably your best bet if the data is constantly changing. You could create a custom property called "Subjects" and ensure it is set as a "multi-line text" property. You could then "create or update a contact" and pass values as shown below:

 

{
  "properties": [
    {
      "property": "email",
      "value": "testcontact001@hubspot.com"
    },
    {
      "property": "firstname",
      "value": "Jack"
    },
    {
      "property": "subjects",
      "value": "Option 1, Option 2, Option 3, Option 4"
    }
 ] 
}

Once the data is passed to HubSpot you would then be free to segment using lists or enroll into workflows based on the data contained in this property.

 

Be mindful that if you choose to move forward with the above option if you pass a new value in to the "subjects" property  at a later stage it won't be appended. It will replace all existing values.  Therefore you'd need to ensure you pass through a request like this in order to update a contact accordingly:

 

{
  "properties": [
    {
      "property": "subjects",
      "value": "Option 1, Option 2, Option 3, Option 4, New Subject Here"
    }
 ] 
}

I hope this helps,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
JonathanNail
Teilnehmer/-in | Diamond Partner
Teilnehmer/-in | Diamond Partner

Support for a One-to-Many mapping for a Contact Property not restricted to a list of allowed values

lösung

Jack, I like what you're proposing, this is how I've been storing serialized data on Iterable and simliar platforms that use JSON to package up the data.

How does the search function/segmentation within Hubspot deal with this serialized data? I'm ok with the need to update the entire field, but how do I pull out or reference those individual "subjects" - I.e. segment on Subjects: Option 2

 

 

0 Upvotes
jackcoldrick
HubSpot Employee
HubSpot Employee

Support for a One-to-Many mapping for a Contact Property not restricted to a list of allowed values

lösung

Hi @JonathanNail,

 

If you are referring to segmentation within the HubSpot tool itself this won't be a problem. You can filter by a multiline text property by using the "contains" filter and simply enter the options/strings you wish to segment by. See below:

 

Screen Shot 2020-03-18 at 9.25.56 AM.png

 

Additionally you are able to use our CRM Search API to extract this information programmatically. More information on this can be found here: https://developers.hubspot.com/docs-beta/crm/search

 

I hope this helps,

Jack

Jack Coldrick
Solutions Engineer @ HubSpot
Add me on LinkedIn
0 Upvotes