You need to sign in to do that
Don't have an account?
lnryan
Null Pointer Exceptions from Customer Settings Checkbox fields
I'm getting a null pointer exception when I try to use evaluate a checkbox field from my BusinessChannels__c custom setting and the checkbox is unchecked. It seems like kind of a joke to have to set up an if statement like
if(null!=bc.get('somefield__c')&&(Boolean) bc.get('somefield__c'))...
instead of simply
if((Boolean) bc.get('somefield__c'))...
or simpler
if(bc.get('somefield__c'))...
am i missing something obvious? thanks!
Inryan,
try this syntax
leider nicht.
the getInstance(String) method returns a record from the custom settings set, not a field within that instance.
Try some thing like this... Not sure though.
Replace 'United States' with the name of the custom setting record you wanna retrieve.
Thanks
Thank you for your suggestions. Perhaps my question was unclear:
I am not have trouble retrieving datasets from Custom Settings. I am asking if there is a better way to error-proof a null value in a checkbox field than a two part if statement in the form of if(null!=field&&field).