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

Custom setting cannot soql in packages


So I've created a Public List type Custom setting and I'm accessing it in a normal way


XXX__c cs= XXX__c.getInstance('login');
system.debug('###login ' +cs.YYY__c + ' '+cs.ZZZ__c);


The 2nd line complains that it cannot find the field. Ive checked and everything exists even the record 'login'.


Note: All of the code completely works in the org that I created the package.


Not sure if there is a Salesforce bug related to Custom settings which cannot be used in packages

Best Answer chosen by Admin (Salesforce Developers) 

Its ok Ive worked it out I didnt put my namespace before the fields