CMS Development

ChrisChiha
Top Contributor

Populating HubDB table from custom object

SOLVE

Hello,
 
I previously built some scenarios where i am auto-populating my hubdb tables from external sources using API.

  

However, I currently have a scenario where i want to fetch data from a custom object into a hubdb table. What is the easiest way to achieve this?
 
Thank you!

0 Upvotes
1 Accepted solution
LeeBartelme
Solution
HubSpot Employee
HubSpot Employee

Populating HubDB table from custom object

SOLVE

If you want to do it all within HubSpot I think the simplest approach would require ops hub pro. Use custom coded workflow action based on changes on the custom object. You can then push data using APIs into hubdb from the workflow.

If you can run code outside of hubspot, you could use workflow webhooks from HubSpot to push data to external code using APIs to push the data to HubDB. But I think you still need ops hub pro for webhook actions.

 

Currently developer apps can't run webhooks from custom objects, otherwise that might be the best route.

 

Using external code, you could potentially poll the search API to get a list of recent changes for your custom object and return the properties you need and then update your HubDB data every so often. Not ideal, and would use more API calls, but could probably work.

View solution in original post

0 Upvotes
3 Replies 3
LeeBartelme
Solution
HubSpot Employee
HubSpot Employee

Populating HubDB table from custom object

SOLVE

If you want to do it all within HubSpot I think the simplest approach would require ops hub pro. Use custom coded workflow action based on changes on the custom object. You can then push data using APIs into hubdb from the workflow.

If you can run code outside of hubspot, you could use workflow webhooks from HubSpot to push data to external code using APIs to push the data to HubDB. But I think you still need ops hub pro for webhook actions.

 

Currently developer apps can't run webhooks from custom objects, otherwise that might be the best route.

 

Using external code, you could potentially poll the search API to get a list of recent changes for your custom object and return the properties you need and then update your HubDB data every so often. Not ideal, and would use more API calls, but could probably work.

0 Upvotes
ChrisChiha
Top Contributor

Populating HubDB table from custom object

SOLVE

Hello @LeeBartelme ,

 

Thanks for your reply!

  

Honestly i've been trying to find a way to check for changes in custom object through custom code but couldn't find any documentation/sample. 

Was able to usw custom code to solve many issues i faced, but this one wasn't able to build the code logic

0 Upvotes
LeeBartelme
HubSpot Employee
HubSpot Employee

Populating HubDB table from custom object

SOLVE

If you are using a workflow, and are working on a subset of properties, you could use property is known with OR filters so you can check each property you are interested in. If you need to look at every property, and there are a lot, that might be a lot of OR filters, but could still be doable. (is know will trigger on any change to that property).

 

If that doesn't work, I can't think of a better way than polling the search API by the last modified date property on the object. If you check every 20 minutes or something, you could search for any updates in the last 20 minutes using last modified date > 20 minutes ago essentially.

Then at least you'd have all the recently updated records and can process them however you need. Until they get webhooks for custom objects, those are the two methods I can think of.

0 Upvotes