You are here

public function RestClientInterface::objectUpsert in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClientInterface.php \Drupal\salesforce\Rest\RestClientInterface::objectUpsert()
  2. 8.3 src/Rest/RestClientInterface.php \Drupal\salesforce\Rest\RestClientInterface::objectUpsert()

Create new records or update existing records.

The new records or updated records are based on the value of the specified field. If the value is not unique, REST API returns a 300 response with the list of matching records and throws an Exception.

Parameters

string $name: Object type name, E.g., Contact, Account.

string $key: The field to check if this record should be created or updated.

string $value: The value for this record of the field specified for $key.

array $params: Values of the fields to set for the object.

Return value

\Drupal\salesforce\SFID The new object's SFID, if created. NULL if updated. This is not ideal, but this is how Salesforce's API works. Go upvote this idea to fix it:

1 method overrides RestClientInterface::objectUpsert()
RestClient::objectUpsert in src/Rest/RestClient.php
Create new records or update existing records.

File

src/Rest/RestClientInterface.php, line 245

Class

RestClientInterface
Objects, properties, and methods to communicate with the Salesforce REST API.

Namespace

Drupal\salesforce\Rest

Code

public function objectUpsert($name, $key, $value, array $params);