Share feedback, ideas and get community help

Updated 2 months ago

Variables to Zapier from javascript

I am using a Set variable block with value: Custom. I have this javascript in it (Execute on client? = true):

function getCookie(name) {
const value = ; ${document.cookie};
const parts = value.split(; ${name}=);
if (parts.length === 2) return parts.pop().split(';').shift();
}
const myCookieValue = getCookie("hubspotutk");
return myCookieValue

The variable gets set, I can retrieve the value and print it as a text bubble in the chat.

However, for some reason when I try to return the variable using a Zapier block, the variable isn't included in the return. The variable just isn't there.

Any variables I set through an Input Text block using "Save the answer in a variable" DO show up in Zapier. But these that I'm setting through the Set variable block with JS are not.

Any idea what I'm doing wrong?
B
1 comment
I'm struggling to understand the Zapier part

  1. Steps to reproduce
  2. What's happening
  3. What were you expecting
It's even better if you can provide a screen recording.
Add a reply
Sign up and join the conversation on Discord