Groovy 25 – Trigger Performance and Avoiding Threshold Errors

Best performance when busing scripting is obtained with the usage of “Before” triggers.

Like Before Update in Database and Before Insert In Database

So whenever possible try to use this type of trigger.

The reason is that when using “After”  (After update in database, After Insert in Database, After Changed Posted to Database, After Commit) the data was already send to the database and via this type of triggers you are doing new modifications to the record which will require a second DML operation to happen per modified row, so that the data modified is send to the database for permanent storage.

Hence this multiplies the number of transactions that happen between Application and Database slowing down performance.

So would be good that when is possible use Before triggers.

Another case I see happening with scripting is the error Post threshold limit reached. Some entities yet to be posted.

This is encountered when you use in trigger of type After method setAttribute()

Because the values is set on a field and then sent towards the database , but before getting inserted in the Database it is subjected to internal ADF validations, to ensure data integrity, once the values pass the validations are getting re-posted to the DB.

When that happens the trigger may fire gain creating a cycle.

The easiest way to avoid this error is to use this technique

if(API_FIELD != Value)  


One thought on “Groovy 25 – Trigger Performance and Avoiding Threshold Errors

Leave a Reply

Your email address will not be published. Required fields are marked *