0

I'm getting this error warning:Unknown field on SOQL.

packages/lesson/main/default/classes/EligibleSubjectHandler.cls:3          
packages/lesson/main/default/classes/EligibleSubjectHandler.cls:30          
Salesforce Graph Engine couldn't resolve the Security               
https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/apexflsviolation-rule.html                         

parameter passed to [READ] operation with field(s) [Unknown]. Confirm that this operation has the necessary FLS checks. 

Here is the code:

List<Contact> teacherList = Database.query(String.escapeSingleQuotes(query), AccessLevel.USER_MODE);

I tried multiple ways to bypass this warning since Unknown is quite irrational. I then changed it to:

List<Contact> teacherList = Database.queryWithBinds(
      String.escapeSingleQuotes(query),
      bindVariablesMap,
      AccessLevel.USER_MODE
);

After this change, the SFDX scanner tool actually passed it. Does anyone have experience with this and can explain why? Is this a tool issue or a coding issue?

0

You must log in to answer this question.

Browse other questions tagged .