function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John Commute Tracker DevJohn Commute Tracker Dev 

Schema.getGlobalDescribe().keySet().contains('site') is returning false from class but returning true from Developer console.

Hi All,

I am using survey force application by Salesforce labs. Inside SurveySitesUtil class, below  code is returning false however, when I run the same code from Developer console its returning true. Also I am seeing code running from class is not pulling all the objects including 'Site". 

Schema.getGlobalDescribe().keySet().contains('site')

Looking forward for assistance on this issue.

Thanks.
PratikPratik (Salesforce Developers) 
Hi John,

Is class written using "with sharing" keyword?

Thanks,
Pratik
John Commute Tracker DevJohn Commute Tracker Dev
@Pratik yes the class is using with sharing keyword. However I tested it by removing with sharing keyword but still getting the same issue. This application is working fine in another developer edition org. 
PratikPratik (Salesforce Developers) 
Hi John,

Can you just replace "with sharing" with keyword  "without sharing" and then try.

Thanks,
Pratik

P.S. If this answers you question, please mark it as "Best Answer" so it will help other community members too.
John Commute Tracker DevJohn Commute Tracker Dev
Sorry still getting same result :(