batch – SOQL: First error: missing value at ‘FirstName’
The SOQL string you are creating is missing spaces so instead of valid SOQL:
... FROM Account WHERE FirstName LIKE 'REDACTED%'
the SOQL string you are generating is:
... FromAccountWHERE FirstName LIKE'REDACTED%'
Also an Account does not have a FirstName field.
I would use code like this to make the spacing more obvious in the SOQL expression:
String soql = String.format(
'select Id, Name from {0} where FirstName like {1}',
new Object[] { strObjectName, aName }
});
return Database.getQueryLocator(String.escapeSingleQuotes(soql));
and the escaping is to avoid the SOQL Injection risk.
Read more here: Source link
