How to do it...

Carry out the following steps to develop an Apex Controller, which is used as part of the account search mechanism, using the Salesforce Developer Console:

  1. Click on the Setup gear icon, as shown in the following screenshot:

The Setup gear icon is located in the top right-hand area of the main home page.

  1. Click the Developer Console option, as shown in the following screenshot:
  1. In the resulting Developer Console window, click on File.
  2. Click on New.
  3. Click on Apex Class, as shown in the following screenshot:
  1. In the resulting New Apex class dialog, enter AccountSearchController in the Please enter a name for your new Apex class textbox.
  2. Click on OK, as shown in the following screenshot:
  1. In the resulting Apex class edit page, paste the following code:
public without sharing class AccountSearchController { 
   @AuraEnabled 
    public static List<Account> getAccounts(String psSearchText
{ String sSearchName = '%' + psSearchText + '%'; List<Account> accounts = [ SELECT Id, Name, Type, Industry, Description, Phone FROM Account WHERE Name LIKE :sSearchName ]; return accounts; } }
  1. Click on File.
  2. Click on Save, as shown in the following screenshot:
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset