Code Segment: createAccount.js
Here is the saveAccountRec()
function in our JavaScript controller:
To support a modular design, I perform the new account creation in a separate function
called createAccount()
.
In the segment above we see the call to createRecord()
.
When creating a new account record, the only required field is the Account Name. Let’s create a record to see how it looks to the user:
After we enter data and click on the Create button, we’ll get a toast Success message and we’ll be taken to the default account home screen, where we will see our new record:
That’s it! We have used the CreateRecord()
function in the
lightning/uiRecordApi
to handle the C (Create) in our CRUD
example.