This is pretty basic but I'm stuck and could use a fresh pair of eyes or two. I'm trying to batch process an upsert. Here is my code:
Code:
foreach ($CreateSO as $num => $MPId) {
foreach ($list as $cont) {
if ($MPId == $cont->Id) {
$fields = array (
'Payment_Status__c' => $Status
);
$sObject = new SObject();
$sObject->fields = $fields;
$sObject->type = 'Monthly_Program__c';
$sObject->Id = $MPId;
array_push($sObjects, $sObject)
}}}
$Response = $mySforceConnection->update(array($sObjects));
print_r($sObjects);
I'm getting a fatal error regarding the type
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object hasn't 'type' property in /home/content/81/5958681/html/independentlivingbullion/sandbox/monthlyprogram/SforceBaseClient.php:414 Stack trace: #0 /home/content/81/5958681/html/independentlivingbullion/sandbox/monthlyprogram/SforceBaseClient.php(414): SoapClient->__call('update', Array) #1 /home/content/81/5958681/html/independentlivingbullion/sandbox/monthlyprogram/SforceBaseClient.php(414): SoapClient->update(Object(stdClass)) #2 /home/content/81/5958681/html/independentlivingbullion/sandbox/monthlyprogram/SforcePartnerClient.php(128): SforceBaseClient->_update(Object(stdClass)) #3 /home/content/81/5958681/html/independentlivingbullion/sandbox/monthlyprogram/StatusUpdate.php(118): SforcePartnerClient->update(Array) #4 {main} thrown in /home/content/81/5958681/html/independentlivingbullion/sandbox/monthlyprogram/SforceBaseClient.php on line 414
Here is the print_r results:
Array ( [0] => SObject Object ( [type] => Monthly_Program__c [fields] => Array ( [Payment_Status__c] => Cleared ) [Id] => a0x30000000aMk5AAE ) )
I've been staring at this for hours and just can't figure out why it is not seeing the type.
Bookmarks