I'm trying to see if an object exists using the following code:
public with sharing class GenericUtils {
public static Boolean doesObjectExist(String objectName) {
Map<String, Schema.SObjectType> result = Schema.getGlobalDescribe();
return result.containsKey(objectName);
}
}
When I run the following in the Developer console, it returns false.
System.debug(GenericUtils.doesObjectExist('LiveChatTranscript'));
However, when I run this in the Developer console, it returns true.
Map<String, Schema.SObjectType> result = Schema.getGlobalDescribe();
System.debug(result.containsKey('LiveChatTranscript'));
I have tried making the GenericUtils class both with and without sharing with no change in outcome. When I inspect the keySet of the map they return two different sets of data. Is there something that I am missing, or is this expected behavior?