Problem/Motivation

When mapping a Webform Checkbox (single checkbox) to a HubSpot Checkbox. The values don't match, resulting in a HubSpot error: "This value wasn't passed to the Contact record. '1' isn't one of the allowed options." for that mapped particular property.

Steps to reproduce

  1. Create a Webform with a single checkbox, and another text input
  2. Create a HubSpot with a single checkbox, and another text input
  3. Adding the HubSpot handler and map the Webform to the HubSpot form, mapping the checkboxes together and the text input together
  4. Try to submit the form
  5. Check the submission on HubSpot. You'll notice that the text input value was sent, but the checkbox mapping displays an error: "This value wasn't passed to the Contact record. '1' isn't one of the allowed options."

Proposed resolution

  • Change the value type for a single checkbox when mapped, from 1 to "true" and from 0 to "false"

Comments

Mohammed J. Razem created an issue. See original summary.

Viktor-T’s picture

I can second that, the checkbox values are not being passed correctly, which makes the checkboxes unusable.

abedajam’s picture

StatusFileSize
new1.03 KB

Attached is a patch that checks the type of component and converts the checkbox value into true or false

mohammed j. razem’s picture

Status: Active » Needs review
Viktor-T’s picture

applied this patch, and mysteriously, the site is started to send out ~2k emails on each submission,
only one submission registered on the form and only one on the HubSpot side.
unsure about the cause yet.

mohammed j. razem’s picture

@Viktor-T
Would you be able to send a sample codebase to reproduce?
Or can you provide steps to reproduce? You can also try the patch and module on simplytest.me

mkrizaj’s picture

@abedajam Your patch doesn't work if the checkbox field is within the wizard page.

Might be good to fix this, because I am also getting "This value wasn't passed to the Contact record. '1' isn't one of the allowed options."

mkrizaj’s picture

I am attaching new patch which should work now.

  • richgerdes committed 74c022b on 8.x-1.x authored by mkrizaj
    Issue #3212295 by mkrizaj, abedajam: Webform to HubSpot Checkbox mapping...

  • richgerdes committed 709785d on 3.x authored by mkrizaj
    Issue #3212295 by mkrizaj, abedajam: Webform to HubSpot Checkbox mapping...
richgerdes’s picture

Status: Needs review » Fixed

Thanks for working this out. I've committed the patch from #8 to both 8.x-1.x and the new 3.x branch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.