We’re building a library of custom code actions so you can automate anything in HubSpot. What do you want to be able to automate? Submit your ideas in the comments below or upvote your favorite ideas, and we’ll add them to our use case library.
Have you built your own custom code actions? Let us know in the comments and we’ll feature them (and credit you!) in this HubSpot resource.
Tell me more: The Programmable automation feature in Operations Hub enables you to execute code directly within HubSpot workflows. Programmable automation encompasses three automated actions in HubSpot: a new “custom code” action in workflows, the “create a webhook” action in workflows, and custom-coded bot action in chatflows.
How it works: Programmable automation encompasses three automated actions:
Ideas & inspiration: With custom code actions, you can create custom workflow or bot actions using JavaScript or any Node.js library. These custom actions can be used to make API calls, run SQL queries, model objects, and anything else you can think of. Here are some examples to spark your imagination:
Enriching HubSpot records with third-party data. For instance, when a lead fills out a form, query another database and append that data to the HubSpot record, then create a task if the data is worth following up on.
Automate your renewal management. For example: when a deal closes, automatically create a new deal in the future and remove a discount from the price.
Create complex calculated lead score properties. You can manipulate and transform your property value in any way you choose and create a lead score using data from HubSpot and inputs from a dozen other systems, and then populate that value in a custom HubSpot property.
To help you get the most out of this feature, we’ve created a library of custom code actions that you can use right now in HubSpot. All you need to do is scan the library, get the code and start automating the tasks and processes you’re using to run your business on HubSpot. Need to automate something but you don’t see it in the library? Submit your idea below and we’ll get right on building it for you.
If you know code and you’ve been building your own custom code actions, we’d love to feature your work (and give you credit!) in this resource. Leave us the code in the comments below and we’ll reach out to you. We can’t wait to see what you’ve built!
I think this is a great idea! I’ve been looking for resources using coded workflows that leverage HubDB tables rather than external databases. This was just mentioned in the webinar as an example (rep assignment) - but no code was offered. Can someone pleased flesh out this kind of example?
I think this is a great idea! I’ve been looking for resources using coded workflows that leverage HubDB tables rather than external databases. This was just mentioned in the webinar as an example (rep assignment) - but no code was offered. Can someone pleased flesh out this kind of example?
@Connorj13 Connor, do you have code for this already or should I add to the buld-next list we have going here at HubSpot? Please let me know - thanks!
I don’t have code that I can share with you since its in a client org, but you’d essentially be creating a table in HubDB with reps and then criteria for each rep (like a list of zipcodes) and then you’d use the Get Table endpoint on the CMS Hub API: https://legacydocs.hubspot.com/docs/methods/hubdb/v2/get_table
You should then be able to intake that and build your logic around it.
Connor - appreciate the comment. I know my way around HubDB table use in CMS, but not in Ops Hub. I have a couple of cases where coded examples built around HubDB (not necessarily sales rep assignment, but related applications) that use this internal resource to the max could flip clients into becoming new Ops hub customers.
Great idea for this post, @maggiebutler. I’d love to see some templates for automatically contacts to tickets. For example, users who use a third party phone service have the call engagements logged on the contact record and on open deals, and having those engagements also surfaced on any open tickets is super helpful as well.
This same idea would also be helpful to have some custom code templates available for custom object association based on a variety of factors, such as an internal ID number or any other value that could be referenced to determine what other objects to associate to the new custom object.
I have a suggestion. I’d like to see custom codes that let us assign tasks for specific dates in the year.
Here’s our use case. For every B2B client (company) we serve, there are 15 tasks that have to be done each year at very specific points of the year. January 1, January 15, February 3, February 20, etc. These tasks are the same for each client, but right now we have to go in and manually create those tasks since the workflow tool does not allow specific deadlines, only “delays” between deadlines.
Is there a chance we can use this to create tasks based on designated dates? Tasks should be assigned to the company owner. If we have to go in once a year to update for the following year, that’s okay. Better than creating them over and over each time.
Also would be great to also have a more step by step instruction on how to use these code snippets from the library, i.e videos of how to implement for people new to code
I second the concept of associations, especially now that we have the new association types feature that dropped yesterday.
We have a use-case right now where if a contact submits a form, we could then label them with a specific association type to their company. Then if we trigger company-based workflow, we can email only the contact that was relevant rather than all the contacts.
Similarly, if a company-based workflow creates a new deal record, it would be great to associate that deal only to contacts with a certain association type.
We are a SaaS company and when we close a deal, the line items on the deal will be 1 of 2 options. Those options are managed by properties, so it would be great to have a custom coded workflow that autofills the line item with a SKU based on the property.
A custom code action that mimics the functionality of associ8 would be awesome. The principle:
Find a target object record (like company, deal, etc.) using a value in a source/workflow record property as a lookup value in a target record property.
Create an association between the workflow record and the returned target object record.
Being able to define the label of the association.
Bonus: ‘Triangle mode’: be able to find a target object A record using a lookup value in source object record property, then find a target object B record using a lookup value in a second source object record property, then create an association between object A record and object B record.
Example:
Deal record has a property called “Machine ID”. The workflow action uses the value in this property to find a corresponding record in the Machine Custom Object with the same ID, then create an association between the deal and this Machine.
Example of the ‘Triangle mode’: Deal record is associated with (a) Machine(s) and a Company. When the deal reaches stage Closed Won, workflow triggers. Custom code action creates an association between the Machine(s) and the Company associated to the Deal.
@bendonahower@maggiebutler - My experience is that nobody responds when you submit new code ideas. Which is a crying shame for this community - especially for sharing code fragments and techniques among developers.
This can and should be developed as part of a vibrant resource!