Part 3 will teach you how to create authentications, and how users can view different app functionalities based on their privileges.
The last thing you learned in Part 2 was how to create a simple relationship between the staff table and the contact table. Given that your staff table (SCRM_tbl_staff) contains all the employee credentials, it will also serve as your user table.
The following section will show you how to filter for active managers and employees.
Views are used to filter out information you want to see from your tables. So go ahead and click Views on the main left-hand panel to get started.
You’ll need to create two for this tutorial, one for each user role:
VIEW 1: SCRM_Active_Managers
Click the New View link on top and name it SCRM_Active_Managers. Your goal here is to only filter active managers from the staff table.
Select SCRM_tbl_staff from your list of Available Tables, then click the “>” symbol to include it in your list of Selected Tables. Click Next when you’re done.
On this screen, click on the Criteria tab on top. Here you can configure field properties by dragging and dropping logic elements to define your filtering conditions.
You only need to take the necessary elements from the left-hand side and snap them in place on the right. And if you want to start over or remove a mistake, just drag those puzzle pieces over to the trashcan icon on the lower right. The only piece you can’t move anywhere or delete is the original anchor.
To define the filter logic of your active managers, proceed with the following steps:
This View will now filter and display active managers. But notice when you click Open inside the container for SCRM_Active_Managers, it doesn’t show any data. That’s because your staff table has no records at the moment.
Resolve this now by clicking the Tables object on the main left-hand panel and opening SCRM_tbl_staff. Next, find the following columns and input the suggested sample data in the Datasheet tab:
When you’re done, go back to the Views object and open SCRM_Active_Managers — John Doe’s credentials should be the only one present.
Go back to the Views object when you’re done checking.
VIEW 2: SCRM_Active_Employees
Your second View will be filtering for active employees, who in this case are Kelly Smith and Tom Jones.
To set it up, click the New View link on top and name it SCRM_Active_Employees. Then select SCRM_tbl_staff once again from your list of Available Tables, and include it to your Selected Tables by clicking the “>” symbol. Click Next when you’re done.
Follow the same procedure outlined in VIEW 1 when defining the logic criteria, except type in Employee instead of Manager in step 4. This will differentiate the logic from your active managers view.
Once you’re done, click Finish and open SCRM_Active_Employees. You should only see Kelly and Tom’s credentials in the resulting table.
This is how you separate your user groups in Caspio. Remember that once you have your role fields defined — you can use Views to separate them, filter the proper information and decide who has access to certain forms and reports.
The next step is to go and build login forms based on your existing Views. One will be for the managers and the other for your employees.
Click the Authentications object on the main left-hand panel to get started.
AUTHENTICATION 1: SCRM Manager Login
To begin building your manager login, click the New Authentications link on top. Then for your Authentication data source, select SCRM_Active_Managers.
You’ll now have two Setup options to choose from:
This tutorial will cover the Custom setup option so go ahead and click the second radio button. Here, users are validated in one of four ways:
Validate with a Caspio data source by clicking the first radio button. This will unlock more configuration options for your authentication form.
Under the Elements panel of the resulting window, you should be able to view your default Authentication Fields. The only change you’ll need to do here is rename the Label of your Email field from User name to Email. This is to intuitively signal users on what to input when logging in.
If you scroll down and expand the section for Advance Settings (Optional), you’ll find more setup options to explore and use. But this tutorial will simply use the default settings. When you’re done, click Create and name this authentication SCRM Manager Login.
Now you have a login screen that only allows John Doe to sign in.
AUTHENTICATION 2: SCRM Employee Login
To build your employee login screen for Kelly Smith and Tom Jones, follow the same procedure of your first authentication.
The only difference lie in selecting SCRM_Active_Employees as your Authentication data source, and in naming the authentication SCRM Employee Login.
Both login screens are now ready to be deployed onto your app widgets or DataPages. This is really as difficult as it gets when setting up a Caspio foundation.
Join us in the next video where we’ll begin building forms and reports.
You’ll quickly learn how they can be used to create workflows, submit data, view information, generate charts and graphs, and implement other functionalities.