Trigger-3

The following trigger will fire before inserting a new record into the Account Object if Type is not equal to 'Prospect' or Type is null error wil display as Wrong Type Enter message and record will not insert into the Account Object otherwise it will update.

trigger Trigger3 on Account (before insert) {
    for(Account a:Trigger.New){
        if(a.Type!='Prospect' || a.type==''){
          a.Type.addError('Wrong type enter');
        }
    }
}
// In this scenario Type field is not Prospect or Null error message will be displayed

Comments

Popular posts from this blog

Page Layouts

SOQL Scenario-1