Posts

Showing posts from October, 2016

Hierarchy Custom Settings in Apex

Hey, How are you guys doing? It's been awhile, I want to start blogging by sharing a trivial thing. How can we directly use a global variable or hierarchy custom settings in APEX just like we use in Visualforce? For Example: We can use {!$setup.hierarchy__c.Name_value__c} in visualforce, and do we have the same comfort for hierarchy custom settings in Apex. Many said, its just one more line why dont you write it and be done with it. They are right, but, I dont want to do that every time I want to refer to hierarchy custom settings in my code. Here is the tip: you can use the same two liner like this combined and you dont have to maintain a variable for that: hierarchy__c.getInstance().Name_value__c I will be posting some more interesting items soon... HTH, Prabhan