I am trying to create a record in Salesforce Enterprise but I get an error message.

The code:


define("SOAP_CLIENT_BASEDIR", "soapclient");
require_once (SOAP_CLIENT_BASEDIR.'/SforceEnterpriseClient.php');
require_once ('userAuth.php');

try {
$mySforceConnection = new SforceEnterpriseClient();
$mySoapClient = $mySforceConnection->createConnection(SOAP_CLIENT_BASEDIR.'/enterprise.wsdl.xml');
$mylogin = $mySforceConnection->login($USERNAME, $PASSWORD);

$sObject1 = new stdclass();
$sObject1->number__c = '20';
$sObject1->name__c = 'testupdateCity';
$sObject1->country__c = 'US';

$response = $mySforceConnection->update(array ($sObject1), 'nisaion_01__c');


} catch (Exception $e) {
echo $e->faultstring;

The error:

Array ( [0] => stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [message] => Id not specified in an update call [statusCode] => MISSING_ARGUMENT ) ) [id] => [success] => ) )

2 Answers 2


Or you can use UPSERT call.

$response = $mySforceConnection->upsert(array ($sObject1), 'nisaion_01__c');

When you can UPDATE call, the ID field is required to uniquely identify which record to update.


welcome to the salesforce stack exchange community!

The problem is that you are using the wrong keyword to create a new record in salesforce.

You have to replace the keyword update with create in the following line:

$response = $mySforceConnection->update(array ($sObject1), 'nisaion_01__c');

The result

$response = $mySforceConnection->create(array ($sObject1), 'nisaion_01__c');
  • Thanks, Christian. The Update works fine. The "create" works but creates 3 records on each submit. Any Ideas? Thanks. David. Commented Dec 24, 2014 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .