function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kora bornkora born 

SQL Error in challenge ?

There is an 'invalid' unwarranted error in the last challenge in VF basics:

There was an unexpected error in your org which is preventing this assessment check from completing: System.QueryException: line 1:47 no viable alternative at character '"

It runs fine:
User-added image

and this is the SQL:
public class NewCaseListController {
    public  List<Case> getNewCases(){
        List<Case> results = Database.query(
            'SELECT Id, CaseNumber ' +
            'FROM Case ' +
            'WHERE status = "New"' +
            'LIMIT 10'
        );
        return results;
    }
}
Best Answer chosen by kora born
Pradeep SinghPradeep Singh
Hi, replace your query by :-
Database.query('SELECT Id, CaseNumber ' +
            'FROM Case ' +
            'WHERE status = \'New\'' +
            ' LIMIT 10'
        );

 

All Answers

Pradeep SinghPradeep Singh
Hi, replace your query by :-
Database.query('SELECT Id, CaseNumber ' +
            'FROM Case ' +
            'WHERE status = \'New\'' +
            ' LIMIT 10'
        );

 
This was selected as the best answer
kora bornkora born
Thanks, I was also thinking of that but then was wondering why when the runtime allowed it the challenge is rejecting it 

Tg the runtime is smarter :)