Newer Version Available
Records Class
Access information about record motifs, which are small
icons used to distinguish record types in the Salesforce UI.
Namespace
Records Methods
The following are methods for Records. All methods are static.
getMotif(communityId, idOrPrefix)
Returns a Motif object that contains the URLs for a set of small, medium, and large
motif icons for the specified 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. See ConnectApi.Motif.
getMotifBatch(communityId, idOrPrefixList)
Gets a motif for the specified list
of objects. Returns a list of BatchResult objects containing ConnectApi.Motif objects. Returns errors embedded in the results for those users
that couldn’t be loaded.
API Version
31.0
Requires Chatter
No
Signature
public static ConnectApi.BatchResult[] getMotifBatch(String communityId, List<String> idOrPrefixList)
Parameters
Return Value
Type: BatchResult[]
The BatchResult.getResults() method returns a ConnectApi.Motif object.
Example
1String communityId = null;
2List<String> prefixIds = new List<String> { '001', '01Z', '069' };
3
4// Get info about the motifs of all records in the list.
5ConnectApi.BatchResult[] batchResults = ConnectApi.Records.getMotifBatch(communityId, prefixIds);
6
7for (ConnectApi.BatchResult batchResult : batchResults) {
8 if (batchResult.isSuccess()) {
9 // Operation was successful.
10 // Print the color of each motif.
11 ConnectApi.Motif motif;
12 if(batchResult.getResult() instanceof ConnectApi.Motif) {
13 motif = (ConnectApi.Motif) batchResult.getResult();
14 }
15 System.debug('SUCCESS');
16 System.debug(motif.color);
17 }
18 else {
19 // Operation failed. Print errors.
20 System.debug('FAILURE');
21 System.debug(batchResult.getErrorMessage());
22 }
23}