Friday, March 9, 2018

Salesforce: "No such column 'BOGUS' on entity"

To hopefully save someone the hours I just wasted. If you see this error message when doing an Create, Update, Upsert or Delete using the Force.com PHP Toolkit:
Fatal error: Uncaught SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: No such column 'BOGUS' on entity 'Thing__c'.
It's because you've double wrapped the record array:
$createArray = array();
$createArray[0]->Foo__c = 'bar';
$createResult = $sfdcConnection->create(array($createArray), 'Thing__c');
The issue here of course being that the array called "$createArray" is being wrapped in another array... Avoid doing that...