+ Start a Discussion
Anonymous DeveloperAnonymous Developer 

Question Regarding Test Class

Can anyone make a test class example using these custom fields:
  • Option Name
  • Option Value
  • Option Type
  • Community ID

any example will do.

Thanks in advance.
AbhinavAbhinav (Salesforce Developers) 
Not sure what you are asking as for test class at first place you will need Apex class.
Based on that logic in Apex you write test class.

Anonymous DeveloperAnonymous Developer
Hello @Abhinav this is the Apex class that I made. The Options__c is the Object while the things listed above are the custom fields.

global class OptionManager{
    public Options__c listcustomsetting { get; set; }
    public OptionManager(){
    public void getlistdata(){
        listcustomsetting = new Options__c();
        Map<String, Options__c> fields = Options__c.getAll();
        List<Options__c> objects = Options__c.getAll().values();
        System.debug('objects size:  ' + objects.size());
        System.debug('objects:  '+ objects);
        Options__c commondata = Options__c.getValues('D');
        System.debug('commondata:  '+commondata);
        listcustomsetting = commondata;