Determining the State of a Row
A row of data can be in any one of the following states:
-
New
A new row that will be inserted into the database during the next save operation.
-
Unmodified
An existing row that has not been modified
-
Modified
An existing row where one or more values has been changed and will be updated in the database during the next save operation
-
Deleted
An existing row that will be deleted from the database during the next save operation
-
Dead
A row that was new and got removed before being saved, or a deleted row after it has been saved
To determine the state of a row in your Groovy scripts, use the function
getPrimaryRowState()
and its related helper methods as shown in the
following example.
// Only perform this business logic if the row is new
if (getPrimaryRowState().isNew())
{
// conditional logic here
}
The complete list of helper methods that you can use on the return value of
getPrimaryRowState()
is shown below:
-
isNew()
Returns boolean
true
if the row state is new,false
otherwise. -
isUnmodified()
Returns boolean
true
if the row state is unmodified,false
otherwise. -
isModified()
Returns boolean
true
if the row state is modified,false
otherwise. -
isDeleted()
Returns boolean
true
if the row state is deleted,false
otherwise. -
isDead()
Returns boolean
true
if the row state is dead,false
otherwise.