RecordActionHistory
Represents the lifecycle of a RecordAction as it goes through different states. Available in API version 44.0 and later.
Supported Calls
describeSObjects(), query(), retrieve()
Special Access Rules
This object is always read-only.
Fields
| Field | Details |
|---|---|
| ActionDefinitionApiName |
|
| ActionDefinitionLabel |
|
| ActionType |
|
| IsMandatory |
|
| LoggedTime |
|
| ParentRecordId |
|
| Pinned |
|
| RecordActionId |
|
| State |
|
| UserId |
|
Usage
The RecordActionHistory object represents the lifecycle of an action on a record as it goes through different states.
The RecordActionHistory object is a big object. For this reason, when you use
synchronous SOQL, SOAP, REST, Bulk, or Apex APIs to read this object, queries must
follow a specific pattern or they fail. Queries must match one of these patterns and use
fields in this precise order when more than one field is used.
- ParentRecordId
- ParentRecordId, LoggedTime (DESC)
- ParentRecordId, LoggedTime (DESC), RecordActionId
For example, this SOQL query follows the ParentRecordId, LoggedTime (DESC) pattern.
1SELECT ActionDefinitionApiName, User, State FROM RecordActionHistory WHERE
2 ParentRecordId = {CaseId} ORDER BY ParentRecordId, LoggedTime DESCAsynchronous SOQL queries do not need to follow a pattern, and can query any field.
Apex triggers cannot reference big object records. Use SOQL queries if you want to query RecordActionHistory records in Apex.
For more information about the Actions & Recommendations component and how it works with RecordActions, see the Lightning Flow for Service Developer Guide. Learn more about big objects and how to query them in the Query Big Objects module on Trailhead.
Java Example
Here’s a Java example of how to query a RecordActionHistory
object.
1public void queryHBPOs(String parentRecordId) {
2 try {
3 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
4
5 // query for the RecordActionHistory associated with ParentRecord
6 QueryResult queryResults = connection.query("SELECT ActionDefinitionApiName, LoggedTime, State " +
7 "FROM RecordActionHistory WHERE ParentRecordId = '" + parentRecordId + "' LIMIT 50");
8 if (queryResults.getSize() > 0) {
9 for (int i=0;i<queryResults.getRecords().length;i++) {
10 // cast the SObject to a strongly-typed RecordActionHistory
11 RecordActionHistory raa = (RecordActionHistory)queryResults.getRecords()[i];
12 System.out.println("ActionDefinitionApiName: " + raa.getActionDefinitionApiName() + " - LoggedTime: "+ format.format(raa.getLoggedTime().getTime()) + " - State: " +
13 raa.getState());
14 }
15 }
16 } catch (Exception e) {
17 e.printStackTrace();
18 }
19 }