Do you hate it when you are working on a project and something that is simple chews up all your time?  The next time you run into that problem, that you know you fixed once and cannnot remember how you did it.  I have one of those instances many times.  The other day while trying to update SalesForce values from a PHP script, I needed to set some records to False.  Simple enough, something like this:

$fieldstoupdate = array( ‘hamberger__c’ => True, ‘mustard__c’ => False);

No problem. Code that up and it does not work.  Error like ” Boolean value needs to be ‘0’, ‘1’, ‘true’ or ‘false'”.  What is wrong with that?  Set them both to true or removed the entry for false and it works fine.  The problem is not case sensitive since it is working for the True, but reported that error for false.  So much searching, testing, updating, guessing, and name calling and I found the answer.

THE ANSWER IS:

This does not make since, but if your value is true, then true, True, and 1 all work.  If you need to set it to false, only 0 (zero) works.

This might seem simple and most are saying why not try that in the first place.  Well I do not think it looks a clean as true and false.   Maybe this will get fixed in the future and someone will tell me that I am full of salt water, but as of today it does not work.

 

Jason “Engineer, not English major”