function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Naveen saini 10Naveen saini 10 

Need Wrapper class of this Apex Class

Hi,
I am newbie in salesforce and wnt to know about  warpper class..
I am making lightning component and i want to wrap my three functions into one wrapper class.

Here is my Code
public with sharing class TestCategoryClass {

    @AuraEnabled
    public static List<String> getIdeaCategories(){
        
        List<String> categorySelectOptionList = new List<String>();
        categorySelectOptionList.add('All');
            for (Schema.PicklistEntry f : Idea.Categories.getDescribe().getPicklistValues()) {
                categorySelectOptionList.add(f.getvalue());
            }
        return categorySelectOptionList;
    }
    
     @AuraEnabled
     public static List<idea> getData(String item)
    {
        if(item!='All')
        {
        	return[select Body,Title,Status,VoteTotal,NumComments,Categories from idea where Categories=:item ];
        }
        
       else
        {
              return[select Body,Title,Status,VoteTotal,NumComments,Categories from idea ];        
        }
    }
     
	  @AuraEnabled
     public static List<idea> getStatus(String Status)
    {
        if(item!='None')
        {
        	return[select Body,Title,Status,VoteTotal,NumComments,Categories from idea where status=:status ];
        }
        
       else
        {
              return[select Body,Title,Status,VoteTotal,NumComments,Categories from idea ];        
        }
    }
}
I want this to include in wrapper and finally return that wrapper from this class
 
NagendraNagendra (Salesforce Developers) 
Hi Naveen,

Please find some exclusive blogs below on combining multiple functions into a wrapper.
  • http://bobbuzzard.blogspot.sg/2015/12/lightning-component-wrapper-classes.html
  • https://balkishankachawa.wordpress.com/2015/05/31/wrapperclass-in-lightning/
Kindly refer to the below articles and modify the code as per your requirement.

Mark this post as solved if it helps.

Best Regards,
Nagendra.P