Skip to main content
Best answer

Why are these false values blank?


Hi! I’m trying to use Zapier to clone a product in an e-commerce app. This is what my zap looks like.

Steps two and three successfully get the product data that I want to use in step 4.

When configuring step 4, this is the data I’ve mapped:

Note the TrackInventory field. The value preview shows false which is what the API returns. It uses false/true instead of 0/1 – but it will accept both.

When I test this step, I receive this error.

Note that the TrackInventory field has no value. Other boolean fields with false as their original value are also blank. Fields with true values in the prior steps output true as expected. It’s the false ones that are doing this.

To get around this, I tried making my API call in a code step, but the result is the same.

Note: The IsPublished field is hard coded to false as I always want it to be false. That works fine when I make my POST call. 

Do you know of a workaround to get this working as expected? 🥺

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

12 replies

Userlevel 7
Badge +14

@ericgranata 

Things to check/try:

Make sure step 2 is returning data for those mapped variables.

Post screenshots of the returned data from step 2 to give us more context.

 

Try turning the Zap ON and testing live.

Then check your Zap Runs history details to see the DATA IN/OUT for each step to help you trace the data between steps and troubleshoot.

https://zapier.com/app/history/

@Troy Tessalone  – here’s a screenshot of a live run that experienced the same issue. As you can see, the TrackInventory value is shown as false.

 

Here’s a look at step 4’s input for the same field.

 

Userlevel 7
Badge +14

@ericgranata 

Observation

Variable values are changing their capitalization from lowercase to propercase, which may be contributing to the issue.

 

That seems to track with the encountered error where F would be the F from False.

Unexpected character encountered while parsing value: F

 

@ericgranata

Observation

Variable values are changing their capitalization from lowercase to propercase, which may be contributing to the issue.

 

Thanks for pointing that out and agreed. I’ve observed that if I “hard code” that TrackInventory value to lowercase false and run the Zap, it works (though ultimately provides the same error calling out the next instance of “False”.

I’m guessing this has something to do with how Zapier is handling/transforming the data. Just not sure if a workaround exists.

Userlevel 7
Badge +14

@ericgranata 

Can you link to the API endpoint docs you reference to configure the Step 4?

Can you post more screenshots showing how all the fields in Step 4 are configured in EDIT mode?

@Troy Tessalone , sure! The endpoint for step 4 is documented at: https://dev.liftoff commerce.com/reference/add-product

Images of step 4 in edit mode below:

 

 

 

Userlevel 7
Badge +14

@ericgranata

May not matter, but try using the same capitalization for the Header.

 

Another thing to check/try…

If you hardcode as shown below (same as “IsPublished”: false), do you get the exact same error related to Line 5?

Or similar error BUT for a different field now with a dynamic variable value of true/false? (e.g. Line N)

"TrackInventory": false,

 

 

 

Possible workaround, would be to use a Code step to generate the JSON structure, then pass that into the Webhook step for the Data field that way there are no variables used only text, and you’ll be able to make sure the boolean values are all lowercase.

@ericgranata

May not matter, but try using the same capitalization for the Header.

 

That has no effect.

 

Another thing to check/try…

If you hardcode as shown below (same as “IsPublished”: false), do you get the exact same error related to Line 5?

Or similar error BUT for a different field now with a dynamic variable value of true/false? (e.g. Line N)

"TrackInventory": false,

 

 

 

If I do that then I get the same error on the next line down that has a true/false dynamic value. Note: In the case where a value is dynamically set to true – in the step 4 output this is respected and I see “true” as the value rather than it being blank like the false values.

 

Possible workaround, would be to use a Code step to generate the JSON structure, then pass that into the Webhook step for the Data field that way there are no variables used only text, and you’ll be able to make sure the boolean values are all lowercase.

I tried something like that already to no avail (those false values were still changed to blank) but perhaps I need to give it another try.

Userlevel 7
Badge +14

@ericgranata 

You need to lowercase the boolean values.

More efficient to do that in a Code step.

Or you can use Formatter > Text > Lowercase

Userlevel 7
Badge +14

@ericgranata 

Concept for using Code to make sure your Boolean values are lowercase.

From your Step 4, copy the whole Data field JSON value

Use that as an INPUT variable for the code step.

Treat as a string and replace all instances of True/TRUE/False/FALSE to be lowercase.

 

Akin to this...

function convertBooleanToLowercase(inputString) {
// Regular expression to match True, TRUE, False, and FALSE
let regex = /\b(True|TRUE|False|FALSE)\b/g;

// Replace matched strings with lowercase versions
let result = inputString.replace(regex, function(match) {
return match.toLowerCase();
});

return result;
}

// Example usage:
let input = "The value is True, but FALSE is not the same as false.";
let output = convertBooleanToLowercase(input);

console.log(output);

 

 

Thanks, @Troy Tessalone. I’ve now got a code step that outputs the modified JSON but only as a string in one field. I think there might be a way to modify my step so that it outputs each field for use in the next step. I’ll mess with it a bit more.

Assuming I got that to work, though, wouldn’t I be in the same position with Zapier replacing false with blanks?

Userlevel 7
Badge +14

@ericgranata 

You can use logic in the Code step to find/replace these values within the JSON string:

FALSE > false

False > false

TRUE > true

True > true