Introduction to Apex class:-
Salesforce has already provided prebuilt application such as workflow, approval process, process builder etc for the CRM functionality. It may be possible that the Organization has much more complex business requirements which cannot achieve by current prebuilt applications. When it happensthe Force.com platforms has following ways for developer to build custom functionality. We Can use Apex for Web Services, Email Services, Provide solution for Complex business requirements which cannot fulfilled by workflow rule. Add custom logic to another operation such as saving record.
How to Write Basics Access modifier:-
Read: How to Export Backup Data from Salesforce?
- Private:- method and variable only we can access in the defining apex class
- Public:- method and variable of an apex class we can access from another apex class as well.
- Protected:- method and variable can be access by any inner classes in the same Apex class, and those classes that extend the defining Apex class. You can only use this access modifier for instance methods and member variables.
- Global :- method and variable can be access from any apex class in the organization or from any other organization.
Apex code:-
Read: Kickstart Your Salesforce Career With Best Salesforce Entry Level Jobs
- How to get list of records using apex class
Ans:-
Public class listofAccountRecordClass
{
Public list<account>getAccountList(){
List<account>accountList = [select id,name,phone,industry,rating from account];
If(!accountList.isEmpty()){
returnaccountList;
}
System.debug(‘accountList’+accountList);
return new list<Account>();
}
}
GO TO ANONYMOUS WINDOW.
Call the class.

Read: What Is The Best Way To Grow Your Salary In Salesforce?
