You need to sign in to do that
Don't have an account?
Edward Scott 17
Query an opportunity
Hi,
I am trying to query the opportunity object to find all closed lost opportunities. After finding those ops I would like to write test op in the opportunity description field. I am getting an error and can't figure out what is wrong. I posted the code below. Any help would be greatly appreciated.
Ed
I am trying to query the opportunity object to find all closed lost opportunities. After finding those ops I would like to write test op in the opportunity description field. I am getting an error and can't figure out what is wrong. I posted the code below. Any help would be greatly appreciated.
//Create a list to store the records that we need to update List<Opportunity> updatedOppList = new List <Opportunity>(); for (Opportunity obj:oppList) { if obj.StageName = 'Closed Lost'{ obj.description = 'test opp'; updatedOppList.add(obj); } } //DML Statement to update the invoice status update updatedOppList; //Prints the value of updated invoices System.debug('List has been updated and updated value of records are'+updatedOppList);Thanks,
Ed
All Answers
Now for some reason I get an error on the '<' by the first opportunity.