The following are methods for Records. All methods are static.
28.0
No
public static ConnectApi.Motif getMotif(String communityId, String idOrPrefix)
Type: ConnectApi.Motif
Each Salesforce record type has its own set of motif icons. See ConnectApi.Motif.
31.0
No
public static ConnectApi.BatchResult[] getMotifBatch(String communityId, List<String> idOrPrefixList)
Type: BatchResult[]
The BatchResult.getResults() method returns a ConnectApi.Motif object.
String communityId = null; // Create a list of records. ConnectApi.RecordSummaryList recordList = ConnectApi.RecordDetails.getRecentRecords(communityId, 'me'); // Create a list of record IDs. List<String> recordIds = new List<String>(); for (ConnectApi.ActorWithId record : recordList.records){ recordIds.add(record.id); } // Get info about the motifs of all records in the list. ConnectApi.BatchResult[] batchResults = ConnectApi.Records.getMotifBatch(communityId, recordIds); 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()); } }