Skip to content

Record API in AfterUpdate ​

Record ​

Type: TriggerTypes.UpdateRecord. Predicates read the new row and never throw on null.

MethodIn AfterUpdate
getId()the record Id
getNewSObject()the Trigger.new row, read-only
getOldSObject()the Trigger.old row, read-only
getNewParent(lookupField)the parent loaded by ParentQuery, or null
getOldParent(lookupField)the old row's parent, loaded by PriorParentQuery, or null
getRelated(providerName)rows from a RelatedQuery provider
put(field, value)compiles, but throws System.FinalException: the row is read-only
isRecordType(recordTypeDeveloperName), isNotRecordTyperecord type developer name matches / differs
equals(field, value), doesNotEqualequal / different; text ignores case
isIn(field, values), isNotInequal to one of the values / to none; text ignores case
contains(field, value), doesNotContain, startsWith, endsWithtext match; case-sensitive
isNull(field), isNotNullnull / not null
isEmpty(field), isNotEmptynull or '' / neither
isBlank(field), isNotBlanknull, '' or whitespace / none
isTrue(field), isFalsetrue / false
greaterThan(field, value), greaterThanOrEqualTo, lessThan, lessThanOrEqualTonumber or date comparison; false for null
isChanged(field)the new value differs from the old one; text ignores case
isAnyChanged(field1, field2, …), areAllChanged(field1, field2, …)any / every field changed; 2 to 5 fields or an Iterable<SObjectField>
isChangedTo(field, expectedValue), isChangedFromchanged to / from the value
isChangedToNotNull(field)changed, and the new value is not null
isChangedFromTo(field, fromValue, toValue)the old value is fromValue and the new one is toValue

Records ​

Type: TriggerTypes.UpdateRecords. RecordsProvider.query gets the whole chunk. dispatchOnAfterUpdate and finalizeOnAfterUpdate get the qualified records.

MethodIn AfterUpdate
getIds()the record Ids
getIdsOf(field), getOldIdsOf(field)non-null Ids in a lookup or Id field of the new / old row
getValuesOf(field), getOldValuesOf(field)non-null values of a field of the new / old row, as text
getRecords()the records, as UpdateRecord
size()the number of records

Pass relationshipName first to read a parent’s field.

Rules ​

  • Parents are not on the row. getNewSObject().Account is null. Read getNewParent or getOldParent.