User Story
As a sales representative, I want the Opportunity Type field to default to "New Customer" when it is left blank while creating a new Opportunity so that I can easily identify and track new potential customers.
Solution 1
trigger OppTrigger on Opportunity (before insert) {
for(Opportunity opp : Trigger.new){
if(opp.type==null || opp.Type==''){
opp.Type='New Customer';
}
}
}
Solution 2
trigger OppTrigger on Opportunity (before insert) {
for (Opportunity opp : Trigger.new) {
if (String.isBlank(opp.Type)) {
opp.Type = 'New Customer';
}
}
}
Video
Video does not exists.