You need to sign in to do that
Don't have an account?
Sujitha Vedagiri
Need help-opportunity trigger to overcome two record insertion in stage history with close date as 31/5/2017
I have written a trigger on opportunity with close date as 31/5/2017 and in stage history it is showing one record as per the stage when i change the stage one more record is inserting. i want only one record to be inserted in stage history with 31/5/2017.
Here is my code.
trigger updateclosedate on Opportunity (before insert)
{
List<id> ids=new List<id>();
for(Opportunity A : trigger.new)
ids.add(A.id);
//List<Opportunity> opupdate=new List<Opportunity>();
list<opportunity> opupdate=[SELECT Id,closedate FROM Opportunity WHERE CloseDate = NEXT_FISCAL_YEAR];
for(Opportunity o: opupdate)
{
opupdate.add(o);
system.debug('opupdate333333'+opupdate);
}
insert opupdate;
}
Can you please help on this.
Here is my code.
trigger updateclosedate on Opportunity (before insert)
{
List<id> ids=new List<id>();
for(Opportunity A : trigger.new)
ids.add(A.id);
//List<Opportunity> opupdate=new List<Opportunity>();
list<opportunity> opupdate=[SELECT Id,closedate FROM Opportunity WHERE CloseDate = NEXT_FISCAL_YEAR];
for(Opportunity o: opupdate)
{
opupdate.add(o);
system.debug('opupdate333333'+opupdate);
}
insert opupdate;
}
Can you please help on this.