"We needed a way to call a specific endpoint which is owned by a 3rd party vendor, they were unable to make a customization to accept the webhook feature, so this was exactly what we needed. We were able to use the workflow to set some properties on the contact and then ship that information off to the vendor to create a user in their system using the Axios library in the custom code feature. It was nice having a few JavaScript libraries pre-installed to work with. As of now, this is a pretty simple use case as we are only making one simple POST request, but we are planning to build some error handling to surround it."
What have you built so far using Custom Code Actions?
@KBansal It did work. However, I get the same error as you do for some reason. But it doesn't prevent me from saving and running the code within the editor, which is a bit confusing. So while the error is there, it doesn't seem to have any impact on the functionality of the code. As a result, I've assumed it's a bug of sorts.
Jun 15, 202111:44 AM - edited Jun 15, 202111:52 AM
Top Contributor | Elite Partner
Use Case: Custom Code Actions at Work
We created a Custom Code Action at Aptitude 8 to help facilitate some internal processes.
Use case
Problem
Projects (custom object) are syncing in from SFDC, but they weren't associated with users and didn't have owners.
Business Case
We wanted to be able to build dashboards inside of Hubspot based on the owner of project records so we could have some visibility on the project ownders
Solution
We built a custom coded action that runs on Projects to "associate" a Project to a user using the "Project Owner" HubSpot User property, which is set based on the "Project Lead Email" property. This property contains the email address of the owner.
Hit the owner endpoint to find and set the "Project Owner" property, by checking for a user with an email matching the value in the "Project Lead Email" property.
Hi @nikodev , Did the above snippet work for you? I'm also developing a custom code action and have to rely heavily on async/await. The workflow editor keeps giving me a parsing error on the async.
I tried pasting your code into the editor and it gave me the same error on line 18:7 "Parsing error: Unexpected token function"
Hi @nikodev! I am loving this! Thank you so much for sharing. Your breakdown of the problem, business case, and solution made it easy to understand the value of the custom code you wrote. Do you usually find your custom code action ideas after you've manually completed a certain action multiple times and so, therefore, you are looking for a way to automate it? Do you notice a pattern like this on how these ideas normally arise for you?
Hi there @mbarba. I'm really late on replying here, and for that I apologize! I'm happy to hear it was understandable.
To answer your question - I work on the RevOps side of our company, heading up our development work there. I work alongside an incredibly talented and knowledgeable group of RevOps Consultants that know HubSpot inside and out.
When they have a problem that can't be solved with HubSpot out of the box, I'm pulled in. The combination of their understanding of the system and my knowledge of code and the HubSpot APIs enables us to come up with some pretty interesting, creative solutions with the help of Operations Hub.
Operations Hub and more specifically, custom code actions has broadened the realm of possibility in HubSpot to a truly tremendous extent. Exciting times within the ecosystem.