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.
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.
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.
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.