Best answer

Webflow checkboxes true/false value to text.

  • 29 January 2024
  • 3 replies
  • 112 views

Hello,

I receive form data from webflow. One of the question has multiple choices, so I’m using checkboxes. On Zapier it returns name of the checkbox and it’s value is either true or false.


I need to send this info to Pipedrive and assign to specific field and for that I need it’s name. I figured custom js code would work but I’m having a problem. I’m trying to asign it’s value to seperate variables and depending if they true or false, give them their according names. Like this: 
(It’s exact copy that I wrote in Zapier custom code. Just copied in VSCode so I could take a good screenshot)

Problem is that even though only first choice is true, code is acting like all choices are true and are givin names to all answers. This is the output:



Why is this happening. I’m pretty sure that in normal environment only first answer would have a string, other’s would be empty value. 

What am I doing wrong? 

icon

Best answer by Troy Tessalone 30 January 2024, 16:49

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Hi @Amal_Emifast 

Your code logic is checking if there is a value for the choices.

The choices will always have a value. (true or false)

You need to further specify the if condition to check if the value == true.

 

 

Also, try asking ChatGPT for help optimizing/commenting your code.

Hello, @Troy Tessalone.

Thank you for a quick answer. The thing is that I tried that before and it still didn’t work.

Now I tried like this choice1 === ‘true’ and it works perfectly, but I don’t understand why? Does Zapier registered returned true/false booleans as strings?  

Userlevel 7
Badge +14

@Amal_Emifast 

Yes, when passed into a Code step as an input.

Help: https://zapier.com/apps/code/help