You need to sign in to do that
Don't have an account?

Error while creating a Trigger ( Error: Compile Error: unexpected token: ':' at line 11 column 84)
Hi I am trying to create a trigger to update the check box whenever the Opportunity stage changes from Closed Won to a new stage. Here is the trigger i wrote and it is throwing me an error. Please let me know whether the way i wrote the trigger is write or wrong. I mentioned the error in Red color
trigger OpportunityUpdate on Opportunity (after update)
{
List <Opportunity> OppList;
List <Id> oppIdList = new List <Id>();
for(Integer i=0; i<Trigger.new.size(); i++)
{
if (Trigger.old[i].StageName == 'Closed Won' && Trigger.new[i].StageName != 'Closed Won')
oppIdList.add(Trigger.new[i].Id);
}
OppList = [select Opportunity.Not_Closed_won__c from Opportunity where opportunity :oppIdList];
if (OppList.size() > 0)
{
if (Opportunity.Not_Closed_won__c != true)
{
Opportunity.Not_Closed_won__c = true;
}
}
update OppList;
}
Hi,
All Answers
Change your query to
OppList = [select Opportunity.Not_Closed_won__c from Opportunity where id in:oppIdList];
Hi Prakash I changed the query as you said. This is the error it is throwing now
Hi,