I need help in resolving the below issue.

I have a community plus user. The user is part of public group and the group has read/write access to all contact records and read access to account records in the entire org using Sharing Rules. This setup was working fine till winter 19.

Specifically SOQLs that read contacts that belongs to "accounts not linked to community user (AccountId in User table) " were working fine.

After winter 19 release, the soql running as community plus login user runs very slow specifically while quering contacts that does not belong to Accounts that are not directly linked to the community plus user record on User table. I was able to reproduce the issue with below Test code.

public class Test_Winter19 { 

static testMethod void demonstrate() { 
User u = [Select Id,AccountId from User where userName = 'jbay@fm.com']; 

Id accRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Seller Servicer Account').getRecordTypeId(); 
account acc = [Select Id from Account where id = '0014D000009yfeUQAQ']; 

contact con = new contact(FirstName = 'different', LastName = 'Account', email = 'different@differentAccount.com', AccountId = acc.Id); 

contact con1 = new contact(FirstName = 'same', LastName = 'Account', email = 'user@useraccount.com', AccountId = u.AccountId); 

insert con; 
insert con1; 

System.runAs(u) { 
System.debug('*****************trying to read different account contact***************'); 
Long startTime = DateTime.now().addDays(-1).getTime(); 

//Contact diffAccContact = [Select Id from Contact where email='different@differentAccount.com']; 

Long endTime = DateTime.now().addDays(-1).getTime(); 
Long milliseconds = endTime - startTime; 
Long seconds = milliseconds / 1000; 
System.debug('*****************completed read different account contact***************'); 
System.debug('total time taken -- ' + seconds +' seconds'); 

System.debug('*****************trying to read same account contact***************'); 
startTime = DateTime.now().addDays(-1).getTime(); 
Contact sameAccContact = [Select Id from Contact where email='user@useraccount.com']; 

endTime = DateTime.now().addDays(-1).getTime(); 
milliseconds = endTime - startTime; 
seconds = milliseconds / 1000; 
System.debug('*****************completed read same account contact***************'); 
System.debug('total time taken -- ' + seconds + ' seconds'); 

Below is screenshot of debug logs for time taken when running the test class from dev console.

enter image description here

  • could you try without setting seeAllData=true – Raul Sep 26 '18 at 12:24
  • I set the seeAllData true in order to by-pass recreating community plus user in test class. I created this test class to demostrate the issue that happens in the Apex class. – Raja Vivekanandhan Sep 26 '18 at 12:29
  • I really think it would be better to create the community user in the test class as using seeAllData is against best practices. – Dave Humm Sep 26 '18 at 13:13
  • I'm curious to see if you get different results running this as an anonymous apex script instead of as a test class. I'm sure you'll still see the performance issue since you're seeing it outside of test context, but I don't know whether there's anything happening behind the scenes that would make a test class run with a lower priority. Let's make sure we're getting accurate numbers. – Shane Steinfeld Sep 26 '18 at 14:11
  • 1
    @RajaVivekanandhan We have a very similar issue, do you have a Known Issue link or some other ID for this defect so I can mention it in my own case with Salesforce? Thanks – David Cheng Oct 8 '18 at 19:42

Salesforce R& D confirmed it as winter defect. They are applying patch on Oct 9th in winter sandboxes.

  • Do you have a known issue link or similar ID? We are experiencing a similar problem and would like to track progress in patching it. Thanks. – Benj Oct 9 '18 at 14:12
  • I was told Salesforce is applying patch in the winter Sandbox tonight. Not sure if this is going to be across all Sandboxes. I will confirm tomorrow. – Raja Vivekanandhan Oct 9 '18 at 22:50
  • The issue seems to be resolved today morning in all our winter sandboxes. I beleive salesforce has applied the patch. The patch did not come as a critical update – Raja Vivekanandhan Oct 10 '18 at 15:53

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.