Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
trigger OpportunityTrigger on Opportunity (before insert){ if(trigger.isInsert && trigger.isBefore){ OpportunityTriggerHandler.OpportunityTriggerMethod(trigger.new); } } Trigger-Handler: public class OpportunityTriggerHandler { public static void OpportunityTriggerMethod(List<Opportunity> oppList){ for(Opportunity opp : oppList){ opp.StageName = 'Prospecting'; opp.CloseDate = Date.Today()+15; } } }
trigger OpportunityTrigger on Opportunity (before insert){ for(Opportunity obj : Trigger.new){ obj.Stage = 'Prospecting'; obj.CloseDate = Date.Today().addDays(15); } }
trigger OpportunityTrigger on Opportunity (before insert){
List<Opportunity> opps = new List<Opportunity>();
for(Opportunity o : Trigger.new){
o.Stage = 'Prospecting';
o.CloseDate = Date.Today()+15;
opps.add(o);
}
If(opps.size()>0){
insert opps;
}
}
Try the following code, it may be helpful for you:
Trigger:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
The trigger can be like this:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi