Lists, Lead Scoring & Workflows

cives
Contributor

Associate Contact With Custom Object Through Workflow

SOLVE

Hi there, I have a custom object titled "on-demand training". These are recorded pieces of e-learning that are available for purchase. I'm looking to create a workflow where:

 

1. Customer requests/purchases on-demand training

2. They are emailed a confirmation

3.  Sent a link to a CMS/Membership web page titled "my trainings"

4. On that page it will show them all of the training that they have requested/purchased.

 

--

 

I know how to create this from a development standpoint, however, I'm unsure how to automate associating the contact with the custom object; this is a necessary step to be able to create the page and display the CRM Association

 

Any ideas?

1 Accepted solution
karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Associate Contact With Custom Object Through Workflow

SOLVE

Hi @cives,

 

There are two ways to approach this.

 

To achieve this after both records have been created already, you would need custom code actions in workflows, only available in Operations Hub Professional. If you do go down that route, this Library For Programmable Automation has snippet relating to associating objects which you could take as inspiration.

 

Looking at your steps, you might also create the custom object via a contact-based workflow (via the "Create record" action in the right sidebar). In that case HubSpot will automatically associate both objects. That would be the only way that HubSpot can currently automatically establish the association, out of the box.

 

Let me know if you have any follow-up questions!

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

8 Replies 8
DStaat
Participant

Associate Contact With Custom Object Through Workflow

SOLVE

Hey @cives,

I'm a little late to the party but have you heard of Associ8? It lets you automatically create associations between objects based on parameters you set. There's some documentation showing how it works here.

Let me know if you have any questions! I'd be happy to talk with you about it in more detail.

Best,

-David Staat

niederberger
Participant

Associate Contact With Custom Object Through Workflow

SOLVE

Hi. I did solve it with this Custom Code.

const axios = require('axios');

exports.main = async (event, callback) => {
  const token_hubspot = {
    headers: {
      'content-type': 'application/json',
      'authorization': process.env.HUBSPOT
    }
  }
  const webinar_id = "6643801446";
  const contact_id = event.inputFields['contact_id'];

  try {
    const response = await axios.put(`https://api.hubapi.com/crm/v4/objects/contacts/`+contact_id+`/associations/webinars/`+webinar_id,[],token_hubspot);
    console.log(response.data);
  } catch (error) {
    console.error(error);
  }

  callback({
    outputFields: {
      hs_object_id: contact_id
    }
  });
}


Cheers, Thomas. 

MiaSrebrnjak
Community Manager
Community Manager

Associate Contact With Custom Object Through Workflow

SOLVE

Thank you for sharing @niederberger & @JoshuaBallard! 🙂 

 

Cheers
Mia, Community Team 


Wusstest du, dass es auch eine DACH-Community gibt?
Nimm an regionalen Unterhaltungen teil, indem du deine Spracheinstellungen änderst


Did you know that the Community is available in other languages?
Join regional conversations by
changing your language settings

0 Upvotes
JoshuaBallard
Member

Associate Contact With Custom Object Through Workflow

SOLVE

There is actually a more elegant solution to this.

Set a unique field inside your Custom Object, amke sure it is set to be unique. 

Then set a unqiue id for the record you are trying to conenct, and now add this as a hidden field (prefilled witht he unqiue id) on the form that someobe fills in

MHolzer
Contributor

Associate Contact With Custom Object Through Workflow

SOLVE

Wouldn't this  connect every contact who fills out the form with this particular custom object?

It wouldn't be unique/individual if there is a prefilled value or?

0 Upvotes
RBozeman
Participant

Associate Contact With Custom Object Through Workflow

SOLVE

Hi @cives

 

Not sure if this is still a priority for you or not, it has been a while. As others have noted, the only options currently for creating associations in Workflows are using Operations Hub and custom coding a solution, or using a third-party app.  

 

Insycle (full disclosure, I work there) allows for you to associate contacts, companies, deals, and custom objects, in bulk, using any field in your database as a matching field. You can also manage primary associations/labels/child-parent associations with Insycle.

 

Then you can schedule that template to run on a set schedule in Insycle (such as every Friday) or add an Insycle Recipe directly into your HubSpot Workflows. That way, you can ensure your associations are set immediately after new data hits your database and before you begin to engage with them. 

 

 

karstenkoehler
Solution
Hall of Famer | Partner
Hall of Famer | Partner

Associate Contact With Custom Object Through Workflow

SOLVE

Hi @cives,

 

There are two ways to approach this.

 

To achieve this after both records have been created already, you would need custom code actions in workflows, only available in Operations Hub Professional. If you do go down that route, this Library For Programmable Automation has snippet relating to associating objects which you could take as inspiration.

 

Looking at your steps, you might also create the custom object via a contact-based workflow (via the "Create record" action in the right sidebar). In that case HubSpot will automatically associate both objects. That would be the only way that HubSpot can currently automatically establish the association, out of the box.

 

Let me know if you have any follow-up questions!

Karsten Köhler
HubSpot Freelancer | RevOps & CRM Consultant | Community Hall of Famer

Beratungstermin mit Karsten vereinbaren

 

Did my post help answer your query? Help the community by marking it as a solution.

JDobson
Contributor | Diamond Partner
Contributor | Diamond Partner

Associate Contact With Custom Object Through Workflow

SOLVE

Currently there is no way to automatically associate and existing contact record with an existing custom object record through workflows unless you use the custom code action (requires Operations Hub Professional).

 

BUT, you can associate a new record to the contact through the "Create record" workflow action. You could try creating a new record using the "on-demand training" custom object for each contact that purchases on-demand training and then put them in a list to keep track of the contacts. If you have a property in your custom object that indicates which training they bought, you could keep track and report on which trainings have been bought by who.

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

John Dobson
Senior HubSpot Consultant at Pearagon

Still have questions? Let's Talk