Validation sequence
The following sequence is followed for the execution of different types of validations when a DML operation is performed:
Call the method handleBeforeProcessRows() on the custom handler once for all the collection of rows that are being posted. The collection of rows includes rows with operations insert, update, delete and validate.
Check if the isSkipDML() method returns the value true on the custom handler. If so, then skip all the steps given below.
Check if the user has access to perform the insert operation on the DataSource. If not, an exception is thrown to the user and all the steps given below are skipped.
If you are performing an update operation, fetch the row from the database matching the primary key values and throw an exception when either zero or more than one rows match the primary key values.
Execute the before insert/update/delete/validate validation script in the order of given sequence.
Invoke the handleBeforeInsertRow(), handleBeforeUpdateRow(), handleBeforeDeleteRow() or handleBeforeValidateRow() method call on custom handler depending on the type of operation performed on a given row.
Set default values based on the attribute definition.
Post the data to the database.
Insert the activity stream.
Execute the after insert/update/delete/validate validation script in the order of given sequence.
Call the handleAfterInsertRow() method on the custom handler.
Call the handleAfterProcessRows() method on custom handler once for all the collection of rows that are being posted.
Note: The steps 3 to 6 are performed in a group for each row in a loop. Similarly, steps 10-11 are performed in a group for each row in the collection.
Last updated