0 votes
1 view
in Salesforce by (11k points)

I've been researching this and trying many variations based off my understanding of how to update a record in an SObject, but I keep getting the following error:

SoapFault exception: [sf:INVALID_TYPE] INVALID_TYPE: Must send a concrete entity type. in /home/public_html/soapclient/SforceBaseClient.php:509

I am able to login successfully to the page, but when I execute the code below, I am getting the error listed above.

  $fieldsToUpdate = array (

        "Name"=>$_POST['Name']

    );

    $sObject = new SObject();

    $sObject->Id = $_POST['prospectID']; // this is the Id of the record

    $sObject->fields = $fieldsToUpdate;

    $sObject->type = 'Prospect__c'; // this is the API name of custom object

    try {

        $response = $mySforceConnection->update($sObject);

    } catch (Exception $e) {

        echo $e;

    }

I am using PHP Toolkit 13.0 from the Force.com developer docs, but not able to get to the bottom of this error. Also, I am using the Enterprise WSDL in sandbox mode, and have the proper wsdl xml assigned.

Thanks.

1 Answer

0 votes
by (27.8k points)

sObject is the base type for all other Salesforce objects that can be updated. When using the enterprise API (SOAP), you'll need to pass instances that derive from sObject. (Lead, Contact, and Account are examples)

Here is the documentation for the update() method as well.

...