Creating the Accounts Model
A good CRM application would have the capability to store and manage client account details. We will therefore start building a data placeholder where we can store information about our clients. Such a mechanism requires a database to store all the related information. In the world of AppFlower, databases are handled automatically through what we call Models. So our first step is to create a new Model which we will name Account to take care of this.
The account Model will beside providing a way of storing client details also provide functionality to add new clients, update and delete existing clients.
Creating the Account Model
Before creating the Account model, we should decide upon what details do we want to store about our clients. This will determine the structure of our Model. Well, in present case, we need the company name, address (city, zipcode, street address 1 & 2, State and country), contact details (phone, fax, email and website) and an optional description field. Also we would like to referrer internally in our application to Accounts by using unique identifiers (IDs).
The new model now gets generated and in a few seconds the Model Editor should show up. This tool has 2 tabs: one named like our model and a configuration tool, called Model Config. For now we will be using the first tab, which is almost like working with Spreadsheets.
We have added 2 fields so far which is:
Seems like this is pretty straightforward, let’s add the rest of the fields to the account model
4. Saving the Model Click Save to close this window, then hit the Save button located at the top to have the new model applied to the database. That’s it you now have created your first new model. Later on we will look into more advanced use-cases of models.
Add content to our Account model
To make use of our Account model we could add some sample data. This will also help us when we are going to test our Application in the next chapter. So let’s add the following content after adding the content remember to click Save so the content gets written to the Database.