Wednesday 1 July 2015

Simple Trigger : If you try to Delete a record, trigger will throw an error you can't do it.



trigger TriggerCanddel on Candidate__c (before delete)
{
   list<Candidate__c> del = trigger.old;
   for(Candidate__C c : del)
   {
       c.adderror('please donot delete the record');
   }
 
}


  1. Trigger Name : TriggerCanddel
  2. Checking with Candidate__c - a custom object.
  3. Context variable : (before delete should have trigger.old ) delete for checking the old record if already present in Salesforce Candidate__c object.
  4. Collection : List for holding all the records.
  5. adderror : for throwing the error statements.

Soon to have a detailed descriptions on triggers.

Monday 29 June 2015

Very Important topic in Salesforce

Triggers are very important topic in Salesforce.

     Few Points to Know more on Triggers

  1. What is Trigger ?
  2. Order of Execution : Triggers
  3. Best Practice.
  4. When to use Triggers
  5. Need to Write Test Class for each trigger.
  6. How triggers are efficient in Salesforce
  7. All to together.
To know more on this Wait shortly !, I'm Writting a blog for you SFDC-ALL. :)