0

Problem: As a Guest User, I'm not able to list/read Topics for Objects in a Community. Some background: I created an apex method that fetches Topics:

public with sharing class Topics {
   @AuraEnabled(cacheable=true)
    public static List<Topic> getTopics() {        
        List<Topic>topics = [select id, name, NetworkId from Topic LIMIT 1000];        
        return topics;
    }
}

The method getTopics is not fetching Topic records.

On the hand, when using without sharing, it works.

public without sharing class Topics {
   @AuraEnabled(cacheable=true)
    public static List<Topic> getTopics() {        
        List<Topic>topics = [select id, name, NetworkId from Topic LIMIT 1000];        
        return topics;
    }
}

Notes:

  • I didn't find a way to share Topics in Sharing Rules.
  • Allow topics in Salesforce Sites and Portals is checked enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.