You need to sign in to do that
Don't have an account?
travis.truett
Add Events to New Opportunity With a Trigger?
I have a triger that is duplicating opportunities when they are set to "Closed Won." When I create those duplicates, There are some events I need to add to them. Is this something I can do in my trigger?
You need to create a new trigger "after insert" to create events for duplicated opportunity
You can also use the same trigger and adding new params to it
i.e :
Try this below code you will get idea
public Trigger addopporunityduplicates on Opportunity(after update,after insert)
{
List<id> dup=new List<id>();
for(Opportunity opp:trigger.old)
{
if(opp.status=='closedwon')
{
dup.add(opp.id);
}
}
}
If you get the answer, please mark it as the correct answer. It will be a help to others who are facing the same problem later.
Regards
Eswar Prasad
Try this below code,if you have duplicate record in those you will finding a status should be closedwon
public Trigger addopporunityduplicates on Opportunity(after update,after insert)
{
List<id> dup=new List<id>();
List<Opportunity> lisopp=[select name,status,phone from Opportunity]
for(Opportunity opp:lisopp)
{
if(opp.status=='closedwon')
{
dup.add(opp.id);
}
}
}
If you get the answer, please mark it as the correct answer. It will be a help to others who are facing the same problem later.
Regards
Eswar Prasad