1

Is there any way to get ALL records of hierarchy custom settings for ALL Users/profiles in apex code and display it as a list on a custom page(lightning component) along with the user/profile names? Say for example, I have hierarchy custom setting defined for 3 users A, B, C and 1 for "Sales" profile . So I want to get a list of these custom setting records as:

A & respective field values, B & respective field values, C & respective field values, Profile & respective field values,

2

You can't do this "for free" using the available methods (getInstance/getValues/getOrgDefaults), but you can query for them. I'd probably do something like the following.

@AuraEnabled global static CustomSetting__c[] getCustomSettings() {
    return [SELECT SetupOwner.Name, SetupOwner.Type, Name ...
            FROM CustomSetting__c
            ORDER BY SetupOwner.Type, SetupOwner.Name];
           ];
}

Replace CustomSetting__c with the correct name, and fill in additional fields for the ... in the field list.

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.