Trying to change the case owner of a specific case by changing the OwnerId value but I am not having any success.. I have compared my query with the docs and I can't understand why it's failing. The examples in the docs are for the Contact object, I could not find examples for Case object but thought it should be the same procedure.
Permissions should not be an issue as I can make updates via workbench on the same field without any problems, however, i'm trying to integrate this with php.
try {
$caseId = "5004z00001fqUIRAA2";
//query to target specific case to update
$query = "SELECT CaseNumber,Id,OwnerId FROM Case WHERE Id = '".$caseId."'";
$queryResponse = $mySforceConnection->query($query);
$queryResult = new QueryResult($queryResponse);
echo "<pre>",print_r($queryResult,true),"</pre>";
//prepare field update
$sObject = new SObject();
$sObject->type = 'Case';
$sObject->fields['OwnerId'] = "0054z000008RuHkAAK";
$sObject->Id = $caseId;
//submit update
$updateResponse = $mySforceConnection->update(array($sObject),'Case');
print_r($updateResponse);
} catch (Exception $e) {
echo $mySforceConnection->getLastRequest();
echo $e->faultstring;
}
Here is the response I get on the initial query to confirm I am getting a response back.
QueryResult Object
(
[queryLocator] =>
[done] => 1
[records] => Array
(
[0] => stdClass Object
(
[Id] => 5004z00001fqUIRAA2
[CaseNumber] => 03161663
[OwnerId] => 0054z000007HMzcAAG
)
)
[size] => 1
[pointer] => 0
[sf:QueryResult:private] =>
)
However, when performing the subsequent query to update the OwnerId value I get the following error:
INVALID_FIELD: No such column 'fields' on entity 'Case'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
The OwnerId field is not a custom field, it's standard field of the Case object. I even confirmed this field exists within the object.
Any Ideas?