2

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.

@isTest(SeeAllData=true) 
public class Test_Winter19 { 

static testMethod void demonstrate() { 
User u = [Select Id,AccountId from User where userName = '[email protected]']; 

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 = '[email protected]', AccountId = acc.Id); 

contact con1 = new contact(FirstName = 'same', LastName = 'Account', email = '[email protected]', 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='[email protected]']; 

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='[email protected]']; 

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

8
  • could you try without setting seeAllData=true
    – Raul
    Sep 26, 2018 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. Sep 26, 2018 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, 2018 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. Sep 26, 2018 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 Oct 8, 2018 at 19:42

1 Answer 1

2

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

3
  • 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, 2018 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. Oct 9, 2018 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 Oct 10, 2018 at 15:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .