1
List<String> userIds = new List<String>();
for(Note n : notes) {
            userIds.add(n.CreatedById);
}
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-

userIds.add('005t0000000cFaFAAU');
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.

1

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.

0

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.