APIs & Integrations

AntB
Member

Bulk import associations

SOLVE

Hi!

I have a custom object called donation_data in hubspot which has in it two email address fields

 

donator_email

supporter_email

 

I have created two associations in the custom object to link this with contacts..

 

{
"label": "Recipient",
"name": "received_recipient",
"maxToObjectIds": 50000,
"category": "USER_DEFINED",
"id": 102
}

 

and 

 

{
"label": "Donator",
"name": "donated_donator",
"maxToObjectIds": 50000,
"category": "USER_DEFINED",
"id": 104
}

 

On the importFileRequest I am trying to specify the associations, but whatever I try, the data is imported but is never associated.  

I am not sure how you specify which email field in the custom object to use for the association.  I have tried one association at a time, but the import just ignores it.

 

columnMappings.Add(new
{
columnObjectTypeId = hsObjectId,
toColumnObjectId = "0-1",
columnName = "association_label",
propertyName = nullString,
idColumnType = "FLEXIBLE_ASSOCIATION_LABEL",
associationIdentifierColumn = true
});

 

In the CSV file, the column "association_label" has the value of "received_recipient", but how do I tell it to pick up "supporter_email" and use this to associate with the contact record ?

 

Any help appreciated, going round in circles at the moment with this one!

Thanks!

 

 

 

0 Upvotes
1 Accepted solution
noahmckeon
Solution
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Bulk import associations

SOLVE

Hi @AntB,

When you're mapping your CSV columns during the import process, you need to map the email fields to the appropriate HubSpot association. However, the HubSpot API doesn't natively support directly associating records via email in an import. You'll typically need to get the record ID and then use that ID for association.

 

Here's a conceptual outline of how you can do it:

  1. Map Email Fields: Ensure that your CSV has both donator_email and supporter_email columns.

  2. Pre-Process Email Fields: You might need to resolve these emails to their corresponding HubSpot record IDs before the import. This would involve querying HubSpot for the records that match those emails. If you already have IDs for the emails, include those in your CSV.

  3. Column Mappings for Associations: Use the IDs to create associations. Your columnMappings object in the import request needs to reference the ID fields.

 

If all else fails, we have a data import/migration tool (no-code) that allows you to build these associations and complete the import into HubSpot rather easily. 

Best,
Noah

SyncMatters | Noah McKeon

View solution in original post

0 Upvotes
4 Replies 4
noahmckeon
Solution
Top Contributor | Elite Partner
Top Contributor | Elite Partner

Bulk import associations

SOLVE

Hi @AntB,

When you're mapping your CSV columns during the import process, you need to map the email fields to the appropriate HubSpot association. However, the HubSpot API doesn't natively support directly associating records via email in an import. You'll typically need to get the record ID and then use that ID for association.

 

Here's a conceptual outline of how you can do it:

  1. Map Email Fields: Ensure that your CSV has both donator_email and supporter_email columns.

  2. Pre-Process Email Fields: You might need to resolve these emails to their corresponding HubSpot record IDs before the import. This would involve querying HubSpot for the records that match those emails. If you already have IDs for the emails, include those in your CSV.

  3. Column Mappings for Associations: Use the IDs to create associations. Your columnMappings object in the import request needs to reference the ID fields.

 

If all else fails, we have a data import/migration tool (no-code) that allows you to build these associations and complete the import into HubSpot rather easily. 

Best,
Noah

SyncMatters | Noah McKeon
0 Upvotes
AntB
Member

Bulk import associations

SOLVE

Noah,

Many thanks for the detailed reply!

I had suspected something similar, by the sounds of it, we should store the new HubSpot contact id against our own contact record when we create the contacts (done in advance) and then send that up with the bulk import for this custom object.  Makes perfect sense, I will give it a go shortly.  I was wondering how the system would be able to match on a loose email relationship!

 

 

 

0 Upvotes
Emma_M
HubSpot Moderator
HubSpot Moderator

Bulk import associations

SOLVE

Hi @Ant , 

 

Thank you for reaching out to the Community!  As a first step, would you mind confirming you have followed the directions outlined here to define associations for custom objects?  

 

I would also love to hear from @TomM2 and @MatthiasKunz - Any ideas on how to associate this custom object with contacts via an import?

0 Upvotes
AntB
Member

Bulk import associations

SOLVE

Hi!  Yes, the associations are all set up (and work if done manually).  The CSV file being sent with this has a column called "association_label" and the field is set to "received_recipient" for this one.  On the UI import, we can specifiy the field to use, but not sure how to do this in the import request ?

Thanks

 

 Screenshot 2024-08-17 083419.pngScreenshot 2024-08-17 083524.png

0 Upvotes