List<String> userIds = new List<String>();
for(Note n : notes) {
Map<String, User> userMap = SystemContextMethodsHelper.getUsers(userIds);
        system.debug('userMap--> ' + userMap);

With above code userMap is empty for community user. Please note that User records are shared to Community user through sharing rule. But when I execute the code through anonymous window as shown below, it retrieves the user record-

Map<String, User> userMap = SystemContextMethodsHelper.getUsers(userIds);
        system.debug('userMap--> ' + userMap);

is it due to Spring ‘19 release on 4th Jan, 2019 as everything seems to be working fine before.

  • are the two runnning user the same?
    – m Peixoto
    Jan 7, 2019 at 10:26
  • nope.. they r not same. Jan 7, 2019 at 10:29
  • could be this your issue? -> developer.salesforce.com/docs/atlas.en-us.apexcode.meta/…
    – m Peixoto
    Jan 7, 2019 at 10:32
  • I am using "without sharing". So ideally it should work Jan 7, 2019 at 10:39
  • 2
    "without sharing" does not work with customer login license...you need to share user records with help of setup --> Community setting --> sharing set
    – Ayub
    Jan 7, 2019 at 11:54

2 Answers 2


It appears to be a Spring '19 bug. In my case the query can return the Users of System Admin profile and the user's own profile but nothing else. My test class was unaffected by this bug.

My use case was sending out Apex generated emails from after insert trigger. So, I pushed the code into future call. The query is working as expected. I believe there is something gone wrong with the 'community context' because the test class is working as desired and also it is working in the asynchronous context.


The issue seems to be resolved now. Have verified it on cs32 org.

Salesforce has applied a patch to fix this issue. Please find below link to know more about this issue. https://success.salesforce.com/issues_view?id=a1p3A000000BMV9QAO

Your Answer

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

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