public interface RecordChange
Note that Records from the RecordChange
are for the current context only.
Passing Records to RecordService
results in an error.
Modifier and Type | Method and Description |
---|---|
Record |
getNew()
Retrieves the new data for the Record.
|
Record |
getOld()
Retrieves the pre-existing data for the Record.
|
void |
setError(String errorSubtype,
String errorMessage)
Sets an error on this Record change.
|
Record getNew()
New data is only available during BEFORE_INSERT, BEFORE_UPDATE, AFTER_INSERT, and AFTER_UPDATE Events.
You can use RecordTriggerContext.getRecordEvent()
to find out which Event caused a trigger to fire.
If the new data is not available this method throws a RuntimeException
.
Note that this returns the full Record, including both data which was modified and data which was not modified.
Record getOld()
Pre-existing data is only available during BEFORE_DELETE, BEFORE_UPDATE, AFTER_DELETE, and AFTER_UPDATE Events.
You can use RecordTriggerContext.getRecordEvent()
to find out which Event caused a trigger to fire.
If the pre-existing data is not available this method throws a RuntimeException
.
void setError(String errorSubtype, String errorMessage)
RuntimeException
.RollbackException
.errorSubtype
- error code returned to users. We recommend using SCREAMING_SNAKE_CASE, for example,
MISSING_PARAMETER. May be empty, but cannot be null.errorMessage
- error message returned to users, for example, "Missing value for field {field_name}".
May be empty, but cannot be null.Copyright © Veeva Systems 2017–2021. All rights reserved.