function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
WobbetWobbet 

INVALID_TYPE: Must send a concrete entity type.

I'm using the PHP developer toolkit 13.0 Enterprise Edition trying to update a Contact to set the Email Opt Out. My code is as follows:

 

$objToUpdate = array();

foreach ($response->records as $record) 

{

$updObject = new stdclass();

        $updObject->HasOptedOutOfEmail = "0";

        $updObject->Id = strval($record->Id);

$objToUpdate[$updObject->Id] = $updObject;

}

foreach($objToUpdate as $toupdate)

{

print_r($toupdate->Id."<BR>");

print_r($toupdate->HasOptedOutOfEmail."<BR>");

}

$response = $mySforceConnection->update($objToUpdate, "Contact");

 

I get the "INVALID_TYPE: Must send a concrete entity type" exception on this. I took out the setting of the "HasOptedOutOfEmail" from the code so that the only thing that would be in the object would be the Id and that still failed.

 

In my WSDL I have tried both of the following SOAP Endpoints and both produce the same result.

            <soap:address location="https://www.salesforce.com/services/Soap/c/15.0"/>

            <soap:address location="https://na3-api.salesforce.com/services/Soap/c/15.0/"/>

 

 

I feel like I'm missing something obvious. What is it? 

 

Many thanks!

 

rjsjr 

Lawrence-CECLawrence-CEC

Hey Wobbit,

 

Does $updObject need to be an SObject Object (i.e. $updObject = new SObject(); )??

 

And perhaps specifying the type in the $updObject itself (i.e. $updObject->type = 'Contact'; )? (not sure if that's needed since I believe the Id includes the object type)

 

It looks to me like $mySforceConnection->update() only takes one parameter -- the array of objects to update -- although it will probably just ignore the extra "Contact" parameter.

 

---Lawrence

 

WobbetWobbet

The SObject is used in the Partner API and I'm using the Enterprise API. The Enterprise API does make use of the 2nd parameter in the update() call.

 

I have tested setting $updObject->type = 'Contact' and that isn't working either.

 

Still looking for help...

 

rjsjr 

WobbetWobbet

So this is really freaking me out. In my code I had

$objToUpdate[$updObject->Id] = $updObject;
 

I modified my code to create an index starting at 0 and incrementing as I iterate over my results as

$objToUpdate[$index++] = $updObject; 

 

And it works.

 

Is the SOAPClient iterating over the array using numeric indices rather than foreach? That would be stunning... Any ideas as to why this would be an issue?

 

Many thanks!

 

rjsjr