in Salesforce by

What is trigger in Salesforce?

1 Answer

0 votes
by

The trigger is defined as an Apex code that executes to perform custom actions, before or after modifications like insert, update, delete, etc. that has done to records in Salesforce.

Triggers can be defined for top-level standard objects, like contact or account, custom objects, and few standard child objects. They are active by default when created. When the specified database events occur, Salesforce automatically fires active triggers.

The syntax for creating a trigger is given below:

trigger TriggerName on ObjectName (trigger_events)
{
   code_block
}

To execute a trigger before or after insert, update, delete and undelete operations, specify multiple trigger events like before insert, before delete, after insert, after update etc. in a comma-separated list.

Related questions

0 votes
asked Nov 25, 2021 in Salesforce by DavidAnderson
0 votes
asked Nov 25, 2021 in Salesforce by DavidAnderson
0 votes
asked Sep 26, 2019 in Salesforce by Robin
...