Skip to main content
Question

Zapier formatter - String to Boolean


I’m getting mad trying to understand the way to correctly format checkbox which returns (on/off) string value, to (true/false) boolean.

I have tried with formatter but can’t replace string to boolean. 
So I decided to generate a table with key value (‘on’ => ‘checkbox’ (true/false)) but when I test my zap it returns the same error: 
 

The error you're encountering is due to the custom_fields.2.value and custom_fields.5.value fields expecting boolean values (true or false), but they are likely receiving data that doesn't match this requirement. In your input data, the fields _cf_4031 and _cf_4032 are mapped to {{_GEN_1737025963056__new__data__f2}}, which should be a boolean value. From the previous step's output, it seems that f2 is correctly set to a boolean (true), so the issue might be with how the data is being passed or transformed in the Zap.

To resolve this, ensure that the data being mapped to these fields is indeed a boolean. You can use a Formatter step in Zapier to explicitly convert or check the data type before it reaches the FourDemItCLIAPI step. Add a Formatter step before the add_subscriber action to verify or convert the value of {{_GEN_1737025963056__new__data__f2}} to a boolean. Use the "Utilities" action in Formatter to ensure the value is either true or false, and then map the output of this Formatter step to the custom_fields in your FourDemItCLIAPI step. This should help prevent the error by ensuring the data type matches the expected input.

I can’t understand this last step with the formatter and, as I told before formatter can’t convert string to boolean. isn’t it?

Could you please share a sample usage of table set to convert checkboxes string output to boolean one?

Thanks a lot

Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+5

Follow these steps:

  • Select the "Utilities" action in the Formatter step.

  • Choose the "Lookup Table" transform.

  • Lookup Key:

    • This is the input value you want to transform (e.g., the checkbox value like on or off).

    • Map this field to the dynamic value from the previous step. For example:

      {{checkbox_field}} (copy paste this)
    • This is the value that will be looked up in the Lookup Table.

  • Lookup Table:

    • This is where you define the key-value pairs for the transformation.

    • Add rows to map your input values to the desired output values. For example:

      • Keyon → Valuetrue

      • Keyoff → Valuefalse

    • To add a new row, click Add value set.

  • Fallback Value:
    This is the default value returned if the Lookup Key does not match any key in the Lookup Table. Set this to a sensible default, such as false or null

Run a test and let me know if it works?


ken.a
Forum|alt.badge.img+6
  • Zapier Staff
  • 6360 replies
  • January 21, 2025

Hi ​@Ljubasafaric,

I just came across your post here and wanted to check in here to see how you’re getting on. Were you able to follow ​@pranayshinde suggestion here?

Please do let us know if you’re still in need of some help on this at all - happy to assist further! 🙂