I have a hierarchy type custom setting with org level defaults and no user or profile override values. I have changed the org level value for one field, but in my APEX tests, the code still retrieves the previous value and not the new value.
I understand the values are cached and it doesn't appear there's a way to expire or reset this cache. Here's what I tried:
- Changed the field value
- Removed the field value
- Removed the org level default value record itself
After doing these three things, the custom settings field value is still the previous value, and not the current value. Here's how I am accessing it in my test:
String setting = My_Custom_Settings__c.getInstance().My_Custom_Setting_Field__c;
I would expect (and thought I have seen) that the cache would reset when the values changes, but that doesn't appear to be happening.