public function SalesforceCommands::describeRecordTypes in Salesforce Suite 8.3
Same name and namespace in other branches
- 8.4 src/Commands/SalesforceCommands.php \Drupal\salesforce\Commands\SalesforceCommands::describeRecordTypes()
- 5.0.x src/Commands/SalesforceCommands.php \Drupal\salesforce\Commands\SalesforceCommands::describeRecordTypes()
Retrieve object record types.
@command salesforce:describe-record-types @aliases sfdrt,sf-describe-record-types
@field-labels active: Active available: Available defaultRecordTypeMapping: Default developerName: Developer Name master: Master name: Name recordTypeId: Id urls: URLs
@default-fields name,recordTypeId,developerName,active,available,defaultRecordTypeMapping,master
Parameters
string $object: The object name in Salesforce.
Return value
\Consolidation\OutputFormatters\StructuredData\RowsOfFields|null The record types, or null if the object was not found.
File
- src/
Commands/ SalesforceCommands.php, line 227
Class
- SalesforceCommands
- A Drush commandfile.
Namespace
Drupal\salesforce\CommandsCode
public function describeRecordTypes($object) {
$objectDescription = $this->client
->objectDescribe($object);
if (!is_object($objectDescription)) {
$this
->logger()
->error(dt('Could not load data for object !object', [
'!object' => $object,
]));
return;
}
$data = $objectDescription->data['recordTypeInfos'];
// Return if we cannot load any data.
$rows = [];
foreach ($data as $rt) {
$rt['urls'] = implode("\n", $rt['urls']);
$rows[$rt['developerName']] = $rt;
}
return new RowsOfFields($rows);
}