Alriiiiight. NOTE: Lightning development requires the creation of many files. It may be useful to write down what you name your various files, so you can easily find them again.

Step 1: Update Your Apex Controller to Put Things in the DB

We are going to add a method called “insertStatus”. It will be great.

Step 2: Make A Component that takes some input

  1. For simplicity, we will put everything into a new component
  2. We will create an attribute called “status” with Type of String. This is the input we will take.
  3. We will have another attribute: a list of strings called “Statuses” to display our status updates.
  4. Set up an init handler to talk to the DB as soon as the component initializes.
  5. We will add an input text area, and a button

Step 3: Write the JS Controller

Our JS controller will have 2 functions – doInit, and submitStatusButtonClick. We are going to define these functions in our helper file.

 

Step 4: Code out the JS Functions in the Helper File

Here is where we are going to write the implementation for helper.loadStatuses and helper.insertNewStatus. The doInit function is basically the same as the last tutorial.

 

Alright. Now you have an app that will accept user input and write it to the DB by creating actual records.

What the heck just happened?

It’s all about keeping track of your function / method names. That’s the name of the game.