0
List<Observations__c> o = [SELECT Employee_Name__c  FROM Observations__c 
WHERE Employee_Name__c == 'Staff-0578'];
for(Observations__c b : o)
{
    b.Employee_Name__c  = 'Staff-0938';
}
update b;

Line: 1, Column: 5 Unexpected token '<'.

I cannot for the life of me figure out why I am getting this error.

Thanks

1 Answer 1

2

Change the == in your query to =

List<Observations__c> o = [SELECT Employee_Name__c  FROM Observations__c 
WHERE Employee_Name__c = 'Staff-0578'];

Also, you cannot update b as its not valid out of for loop's scope. so change update b; to

update o;// which is your original list.
1
  • 1
    Thanks! that solved it, was driving me crazy. Not sure why the error couldn't have pointed that out instead of showing me the first character LOL Commented Jun 5, 2020 at 5:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .