Records Class
Access information about record motifs, which are small
icons used to distinguish record types in the Salesforce UI.
Namespace
Records Methods
These methods are for Records. All methods are
static.
getMotif(communityId, idOrPrefix)
Get a motif that contains the URLs for a set of small, medium, and large motif icons for
a record. It can also contain a base color for the record.
API Version
28.0
Requires Chatter
No
Signature
public static ConnectApi.Motif getMotif(String communityId, String idOrPrefix)
Parameters
Return Value
Type: ConnectApi.Motif
Usage
Each Salesforce record type has its own set of motif icons.
getMotifBatch(communityId, idOrPrefixList)
API Version
31.0
Requires Chatter
No
Signature
public static ConnectApi.BatchResult[] getMotifBatch(String communityId, List<String> idOrPrefixList)
Parameters
Return Value
Type: ConnectApi.BatchResult[]
The ConnectApi.BatchResult.getResult() method returns a ConnectApi.Motif object and errors for motifs that didn’t load.
Example
String communityId = null;
List<String> prefixIds = new List<String> { '001', '01Z', '069' };
// Get info about the motifs of all records in the list.
ConnectApi.BatchResult[] batchResults = ConnectApi.Records.getMotifBatch(communityId, prefixIds);
for (ConnectApi.BatchResult batchResult : batchResults) {
if (batchResult.isSuccess()) {
// Operation was successful.
// Print the color of each motif.
ConnectApi.Motif motif;
if(batchResult.getResult() instanceof ConnectApi.Motif) {
motif = (ConnectApi.Motif) batchResult.getResult();
}
System.debug('SUCCESS');
System.debug(motif.color);
}
else {
// Operation failed. Print errors.
System.debug('FAILURE');
System.debug(batchResult.getErrorMessage());
}
}