Code Segment: customSearchController.cls

Vhe2ndCrudSample - customSearchController.cls

Although this blog is about Lightning Web Components, I’ll quickly highlight some things about the Apex method getAccountList().

The method is annotated with the decorator @AuraEnabled(cacheable=true). @AuraEnabled exposes the method to our Lightning Components (both Aura and LWC). The (cacheable=true) part of the annotation improves runtime performance by caching method results on the client. We can cache method results only for methods that retrieve data but do not modify it.

The function populates an Account list with the results of a SOQL query that returns all accounts that contain the Account Name entered by the user. The “contain” functionality is implemented in Apex/SOQL by LIKE in the Where clause and by the “%” before and after the Account Name.

View ( V ) the Account Record