In Action: Creating a Workflow Using RLS and Filtered Drop Downs
You can create advanced workflows using Caspio Bridge DataPages. You can limit available next step options based on the current status of a record. You can also assign records to specific people from the group responsible for the next step. In this example we will be adding a workflow to the Job Posting System ready-made application. This sample workflow will move a job application record through a number of steps/departments towards the final offer.
Setup and preparation
This article assumes that you have already requested and deployed the Job Posting System ready-made application. The Job Posting System (with our without this workflow) requires 5 DataPages. We will be working with three tables through the course of this article:
- Shared_App_Admins – the authentication table (included in the ready-made application)
- Recruiting_Candidates – the job applications table (included in the ready-made application)
- Look-up_Workflow – the workflow design table (created during the article steps)
There is only one DataPage from the ready-made application that we will alter to create this workflow:
- Manage Candidates
The work flow we are going to add will go through the following steps:
Steps to creating a workflow:
1. Create a workflow look-up table
The first step to create a workflow is to make a table that shows the possible movements of a record. In this example we will create a table called Look-up_Workflow with two fields, Current_Status and Next_Status. These two fields together create a one way street to move a task through the workflow. If you want a record to be moved back and forth between two departments, you will need a separate record in this table for each direction.
2. Add department or task ownership data to the authentication table for each member
In order to direct tasks to the appropriate team or team member, each individual in the authentication table must have a field to hold their department or task responsibility. In this example, each individual has a task level noted in the Department field of their user-profile record. For example, "New Candidate" indicates that they deal with new candidates, not that they are new candidates themselves.
3. Add additional monitoring fields to the Recruiting_Candidates table
Because this example is a recruitment process we are going to allow users to see all of the records currently assigned to their task level, regardless of the individual to whom it is assigned. We will add an additional level of security and information by recording the last person who altered an individual record. This way when a new record appears we can see who advanced it.
- In the Caspio Bridge Explorer window go to the Tables view.
- Open the Recruiting_Candidates table by pressing the Design button.
- Add a new field to the table called Last_Edit.
- Also add a new field called Assigned_To.
Both of these fields should have a Text (255) data type.
- Save your table and close the Design view.
4. Stamp the incoming records with the first department
In this example we are using the Job Posting System ready-made application. New records are created when a public user fills out a job application using the Candidate Application Web Form. This Web Form is already configured to stamp all new records with “New Candidate” status.
This automatic stamping is accomplished by marking the status field as hidden and entering “New Candidate” as the default value.
5. Use Record Level Security to Filter the Search and Report DataPage
Now we will configure the Search and Report DataPage to follow our workflow. First we will set up record level security so that the current end-user sees only the records that have been assigned to their department.
- In the Caspio Bridge Explorer window go to the DataPages view.
- Double-click on the Recruiting – Recruiter Apps folder to open it.
- Select the Manage Candidates DataPage.
- Press the Edit button to open the DataPage wizard.
- Go to the Search Type screen.
- Change the DataPage from a Search Form to using Pre-defined criteria by changing the radio button in the top section.
- Click on Restrict record access based on user identity.
To limit the viewable records we need to identify which field of the source table holds the ownership information that is recorded in the authentication table. In the Recruiting_Candidates table each record has a field called Status. The status data matches the authentication table’s Department field. Select Department and Status in the appropriate dropdown fields. Now when an end-user logs-in they will only see the records with a status matching the department in their user-profile.
6. Display and Stamp the Last_Edited Field
Now we will fill the Last_Edit field by stamping each record modification with information from the current user profile.
- Still in the DataPage wizard editing Manage Candidates, click Next until you arrive at the Select Results Page Fields screen.
- Select the Last_Edit field we added in step 3.
- Move the field to the right-hand panel using the arrow button.
- Click Next.
The Last_Edit data will be visible for each record in the results page.
To stamp a record at each modification we are going to:
- Proceed to the Select Details Page Fields screen and move the Last_Edit field to the right-hand panel.
- Click Next.
- Select the Last_Edit field in the DataPage Elements panel on the left.
- In the Form element dropdown field, select Hidden.
- Select the Authenticated field radio button.
- Choose the authenticated field you would like to record.
Now the record will be stamped with data from the authentication table whenever altered. In this example we are stamping each record with the first name of the current end-user.
7. Configure the dropdown that shows the next step
Now let’s configure the Status dropdown. When configured correctly, this dropdown field will only display the current status, and the options available as the next status based on the workflow look-up table.
- First press the Back button to the Select Details Page Fields screen.
- Select the Assign_To field that we added in step 3.
- Move the field to the right-hand panel.
- Click Next.
You should now be in the Configure Details Page Fields screen.
- In the DataPage elements panel select the Status field.
- Using the Form element dropdown select Dropdown.
- Choose Look-up table or view as the dropdown’s Source.
- Under the Table or view dropdown select the workflow look-up table that we created in step one.
- Change the Field for view and the Field for display dropdowns to Next_Status.
Now we are going to limit the number of options based on the department of the current user.
- Go to the Security tab.
- Click on Limit lookup values based on user identity.
- Select department from the first dropdown.
- Select Current_Status from the second dropdown.
8. Set up the assign to cascading dropdown (optional)
Now that the next step dropdown field has been configured we can make a cascading dropdown that will indicate the team members available in the next step’s department.
- Select the Assigned_To field in the DataPage elements panel.
- Using the Form Element dropdown field select Cascading Dropdown.
- Select Status as the parent field.
- Now using the Table or view dropdown select the authentication table (in our example Shared_App_Admins).
- Select Department in the Filter by dropdown.
This indicates that the data in the Status field will be compared to the authentication table (department field) to determine which records (employees) will be available as dropdown options.
- Choose the fields from the authentication table you would like for display and value. In this example we chose the employee’s first name for both.
- Press Finish.
Testing and formatting
Now we have added a workflow to this ready-made application. You can test the workflow right inside Caspio Bridge. Open your authentication table and add an employee for each step/department, don’t forget that in this example New Applicant is also a step. Keep the authentication table open for easy reference because you will need to log-in and out a few times to simulate the different end-users.
Fill out a new application using the Candidate Application DataPage in the Recruiting – Public Apps folder. Then go to the Recruiting – Recruiter Apps folder and open the Manage Candidates DataPage. Log-in as an end-user with the New Candidate department. Escalate the Application. Log out using the Logout button in the main Caspio Bridge window toolbar. Log-in again at the next level to make sure that the Application has been escalated correctly. Repeat the process until you are sure that the workflow has been correctly implemented.
Once you are satisfied with the functionality you can take a few minutes to customize the look and feel of your DataPages.