You are here

public function RestClient::getRecordTypeIdByDeveloperName in Salesforce Suite 5.0.x

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

Given a DeveloperName and SObject Name, return SFID of the RecordType.

DeveloperName doesn't change between Salesforce environments, so it's safer to rely on compared to SFID.

Parameters

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

string $devname: RecordType DeveloperName, e.g. Donation, Membership, etc.

bool $reset: If true, clear the local cache and fetch record types from API.

Return value

\Drupal\salesforce\SFID|false The Salesforce ID of the given Record Type, or FALSE if not found.

Overrides RestClientInterface::getRecordTypeIdByDeveloperName

File

src/Rest/RestClient.php, line 631

Class

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

Namespace

Drupal\salesforce\Rest

Code

public function getRecordTypeIdByDeveloperName($name, $devname, $reset = FALSE) {
  $record_types = $this
    ->getRecordTypes($name, $reset);
  if (empty($record_types[$devname])) {
    return FALSE;
  }
  return $record_types[$devname]
    ->id();
}