RecordActionHistory
Supported Calls
describeSObjects(), query(), retrieve()
You can also enable delete() in API version 42.0 and later. See Enable delete of Field History and Field History Archive.
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.
- ParentRecordId
- ParentRecordId, LoggedTime (DESC)
- ParentRecordId, LoggedTime (DESC), RecordActionId
For example, this SOQL query follows the ParentRecordId, LoggedTime (DESC) pattern.
SELECT ActionDefinitionApiName, User, State FROM RecordActionHistory WHERE
ParentRecordId = {CaseId} ORDER BY ParentRecordId, LoggedTime DESC
Asynchronous 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
public void queryHBPOs(String parentRecordId) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
// query for the RecordActionHistory associated with ParentRecord
QueryResult queryResults = connection.query("SELECT ActionDefinitionApiName, LoggedTime, State " +
"FROM RecordActionHistory WHERE ParentRecordId = '" + parentRecordId + "' LIMIT 50");
if (queryResults.getSize() > 0) {
for (int i=0;i<queryResults.getRecords().length;i++) {
// cast the SObject to a strongly-typed RecordActionHistory
RecordActionHistory raa = (RecordActionHistory)queryResults.getRecords()[i];
System.out.println("ActionDefinitionApiName: " + raa.getActionDefinitionApiName() + " - LoggedTime: "+ format.format(raa.getLoggedTime().getTime()) + " - State: " +
raa.getState());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}