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
pvelanpvelan 

Null pointer exception

 

Below in my Apex class executes fine for users with sysadmin profile.

Settings__c Settings = Settings__c.getInstance();

 

But for non sysadmin profile users, it is throwing null pointers. All profiles has access to the Apex class. Could someone give me some pointers for this issue? 

Another thing is that 'Settings__c' is seen in the list of custom objects and tried in managed packages too.

 

Thanks

logontokartiklogontokartik

The Settings__C object here is a Custom Settings Object defined as Hierarchy. Hierarchy settings work differently and can have multiple values for different profiles/users.

 

Try going through the below url. - You will get some idea on how this works.  

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_custom_settings.htm

 

 

 

hemantgarghemantgarg

in case of hierarchy custom settings try to have default values in fields.