Read, Update, Delete and Account

Let’s refresh the VHE Second CRUD Sample application. This time from the home page, we select the 2nd option: Edit or Delete an Account.

Vhe2ndCrud-EditOrDeleteAnAccount

When Edit or Delete an Account is selected a different form dynamically appears. The same logic that displayed the Create Account form (LWC createAccount) in our prior example is used to display this LWC, which is called editOrDeleteAccount.

To Read (R) the record we just created, we type “acm” in the Account Name input field and click on Search. We see that our new account record has been found:

Vhe2ndCrud-EditOrDelete-Search for Acme Assoc

How does our app find “Acme Associates, Inc”, when we only entered “acm”?

The LWC editOrDeleteAccount has a child LWC named customSearch. The Search button in the screen capture above is actually in the customSearch LWC. When Search is clicked, an Apex function called getAccountList() is called. Let’s look at some code segments.

Code Segment: customSearch.js