0

I am completing last module of Platform Developer I Certification Maintenance (Winter '19).

I have added inherited sharing keyword in both UtilityClass and in apex controller class TowerMapControllerClass. But I am getting error Ensure sharing rules from the calling class are enforced for the the 'UtilityClass' Apex class.

TowerMapControllerClass

public with sharing class TowerMapControllerClass {
 @AuraEnabled
 public static List<Tower__c> getAllTowers() {
      String theObject = 'Tower__c';
      List<String> theFields = new List<String>{'Id', 'Name', 
      'State__r.Name', 'Tower_Location__Latitude__s', 
      'Tower_Location__Longitude__s'};
      List<String> theFilters = new List<String>();  //empty filter list
      String sortField = 'Name';
      String sortOrder = 'ASC';
      List<Tower__c> allTowers = **UtilityClass**.queryObjects(theObject, 
      theFields, theFilters, sortField, sortOrder);
      return allTowers;
 }
 }

UtilityClass

public inherited sharing class UtilityClass {
...
}
0

Verify all class details as below , this worked for me

  1. public inherited sharing class TowerMapUtilClass {....
  2. public inherited sharing class TowerMapControllerClass {...
  3. public inherited sharing class UtilityClass {....

Let me know if this works for you.

New contributor
Ellen Dimpsey is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.