No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
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(String, String)
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(String, List<String>)
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
1swfobject.registerObject("clippy.codeblock-0", "9");String communityId = null;
2
3// Create a list of records.
4ConnectApi.RecordSummaryList recordList = ConnectApi.RecordDetails.getRecentRecords(communityId, 'me');
5
6// Create a list of record IDs.
7List<String> recordIds = new List<String>();
8for (ConnectApi.ActorWithId record : recordList.records){
9 recordIds.add(record.id);
10}
11
12// Get info about the motifs of all records in the list.
13ConnectApi.BatchResult[] batchResults = ConnectApi.Records.getMotifBatch(communityId, recordIds);
14
15for (ConnectApi.BatchResult batchResult : batchResults) {
16 if (batchResult.isSuccess()) {
17 // Operation was successful.
18 // Print the color of each motif.
19 ConnectApi.Motif motif;
20 if(batchResult.getResult() instanceof ConnectApi.Motif) {
21 motif = (ConnectApi.Motif) batchResult.getResult();
22 }
23 System.debug('SUCCESS');
24 System.debug(motif.color);
25 }
26 else {
27 // Operation failed. Print errors.
28 System.debug('FAILURE');
29 System.debug(batchResult.getErrorMessage());
30 }
31}