⚙ Operations Hub

andrew_moreno
Participant

Store Variables for Future Iterations?

Hi,

 

I'm pretty new to using HubSpot's Custom Code action in workflows, but I was wondering if it was possible to store data inside of a variable for future iterations of a workflow? 

We are creating a workflow to compare zip codes of a contact to zip codes radius from a location we input. We are using an API to retrieve this information from a database and are limited in the amount of calls we can make an hour.

Currently, the only way I can think to do this is making an API call for each contact that becomes enrolled in the workflow, but we would hit out call limit pretty fast. If I could store the information I get from the API call to be used in the future, it would keep Us within the call limit threshold. 

 

Any help is appreciated! Thank you!

Andrew

0 Upvotes
6 Replies 6
CMcKay
Top Contributor

Store Variables for Future Iterations?

@Hollyce @andrew_moreno Funny enough I just found the section I was looking for in the docs: 

CMcKay_0-1672237576049.png

https://developers.hubspot.com/docs/api/workflows/custom-code-actions

 

CMcKay
Top Contributor

Store Variables for Future Iterations?

You used to be able to do this by just storing the variable outside of the context.main function but I've notice that sometimes it restarts if you haven't trigger the function in a little bit. How far apart are the enrollments? I've also had some success with reading and writing out to my database on every run. @andrew_moreno just let me know, also I can hop on a call later today and walk you through it if you want.

andrew_moreno
Participant

Store Variables for Future Iterations?

Hi,

 

I would say once turned on, the enrollments should be triggering at the very least once a minute. It is triggered by new customers or a change in a contact's postal code. If you have time for a call that would be great just to make sure I am doing this correctly. I am available from 3 - 4 CST. 

0 Upvotes
CMcKay
Top Contributor

Store Variables for Future Iterations?

Here's my calendar, you can book time whenever you want: hubspot.com/meetings/carter-mckay

0 Upvotes
kvlschaefer
Community Manager
Community Manager

Store Variables for Future Iterations?

Hi @andrew_moreno,

 

Thank you for reaching out! 

 

I wanted to tag in our community members to see if they have insight.

Hi @CMcKay@Hollyce@PNispel - Do you have experience with storing variables in HubSpot?

Thank you!

 

Best,

Kristen

Hollyce
Contributor | Platinum Partner
Contributor | Platinum Partner

Store Variables for Future Iterations?

I do not have experience storing variables, but I am definitely interested in learning this technique if it's possible. I could use it in a workflow I'm troubleshooting now. 

0 Upvotes