i report this issue happened to me while handling with custom setting. CSV__c is a custom setting, where are stored the configurations of some CSV files that the system has to process. The custom setting is of the type List.

string s = null; 
CSV__c c = CSV__c.getValues(s);
system.debug('@@@@@@@@'+ c);

I supposed that this will return null, while the custom setting method getValues return a record. Do you have any reference on this behaviour? Is not a big issue, i can make a change and check the parameter s, but i didn't found any reference to this behaviour. So I'm reporting this as knowledge and share this strange behaviour.

Furthermore, if i test

CSV__c c = CSV__c.getValues(**null**);
system.debug('@@@@@@@@'+ c);

the salesforce compiler is actually throwing an error.

  • Well, if you include * characters, it's not valid Apex. Any time you have an error, you should include its text on here. Just telling us there is an error is not helpful. Do you see the same behavior with getInstance?
    – Adrian Larson
    Aug 26 '16 at 15:22
  • 1
    ah sorry, error mine, ** was to put bold the text, i cant change the question, anyone can fix? Actually the same behaviour happens also with the getInstance.
    – Klodj_Meta
    Aug 26 '16 at 15:23
  • Yeah, you cannot bold code, except for inline snippets using the ` character.
    – Adrian Larson
    Aug 26 '16 at 15:24

This is a known issue. It should eventually be fixed. It applies to both getValues and getInstance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.