Detecting Row State in After Changes Posted to Database Trigger

When writing an After Changes Posted to Database trigger, if your code needs to detect the effective row state of the current object, use the getPrimaryRowState() function.

For example, it can use getPrimaryRowState().isNew() to notice that the current object was created in the current transaction or getPrimaryRowState().isModified() to conclude instead that it was an existing row that was changed.

The getPrimaryRowState() function is covered in Determining the State of a Row.