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
Vigneshwaran LoganathanVigneshwaran Loganathan 

Compile Error: expecting a semi-colon, found '+Leadsource+'

 if (!Name.equals(''))
      soql +=  ' and firstname LIKE \'String.escapeSingleQuotes(Name)'+'%\'';
    if (!Department.equals(''))
      soql += ' and Department LIKE \'String.escapeSingleQuotes(Department)'+'%\'';  
    if (!Leadsource.equals(''))
     soql += 'and Leadsource includes (''+Leadsource+'')';
               /***************Error in this line********************/

 
CheyneCheyne
You need to escape one of the single quotes. Also, you should add a space before "and Leadsource"

if (!Leadsource.equals(''))
     soql += ' and Leadsource includes (\''+Leadsource+'\')';