Skip to content

Instantly share code, notes, and snippets.

@TheShubhamVsnv
Created July 7, 2021 06:19
Show Gist options
  • Save TheShubhamVsnv/24e86d74dd84c29c11bec05b5ae54316 to your computer and use it in GitHub Desktop.
Save TheShubhamVsnv/24e86d74dd84c29c11bec05b5ae54316 to your computer and use it in GitHub Desktop.
Problem: You need to create an apex trigger on the contact object which trigger whenever a new contact is created or updated and update the description accordingly
trigger TgrContactBeforeInsertUpdate on Contact (before Insert, before Update) {
for( contact c : Trigger.new )
{
if(trigger.isInsert)
{
c.description = 'contact created successfully by insert trigger ';
}
else if(trigger.isUpdate)
{
c.description = 'contact update successfully by else update block';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment