Overview
Audits is feature of the modular solution Employee Records Management (ERM). This is an externally built application (on a lighter stack) that integrates with the platform via APIs/webhooks/SSO to deliver targeted functionality. It operates through API calls as well as direct database queries. The app is scaffolded from a private VisualVault GitHub repository (HRSurvey) and uses Kendo UI JavaScript components for its interface. When configuring the URL, parameters are passed, including a user login token that carries the user's identity and an authentication token. These tokens are used within the Node.js app to verify the user's authentication.
During testing and debugging, the app doesn't require authentication. However, when deployed into VisualVault production sites, users must log in to authenticate the app for proper access and security verification.
Feature Objective
Audit processes can be optimized by implementing a single search screen to locate and select employee records efficiently. This application eliminates the need for navigating multiple folders, reduce search times, and ensure accuracy by consolidating data access into a unified interface.
It includes role-based permissions, allowing users to view only the records of those they manage or are second-level reports. Staff can search by employee name, view matches with their employee numbers, and access documents via the integrated VisualVault document viewer for secure and efficient management.
Primary Features:
Group all audit data into a single object.
Share audit with coordinators.
Select employees to be audited (possible and definite)
Quickly locate employee documents requested by auditors and relate them to the audit.
View all audit documents from a single screen.
Technical Architecture
Application Stack
Layer | Technology |
|---|---|
Runtime | Node.js |
Framework | Express |
UI Components | Kendo UI (JavaScript) |
Authentication | VisualVault user login token + authentication token (bypassed in local dev) |
Architecture | MVC (Model-View-Controller) |
Integration | VisualVault API (no direct database queries) |
Source Repository | GitHub – |
Integration with VisualVault
The Audit Application is integrated into VisualVault by configuring the application source URL in the VisualVault portal. When a user navigates to the application via the landing page widget, VisualVault appends the user login token and authentication token as URL parameters. The Node.js app reads and validates these tokens to authenticate the session.
+-------------------------------+ +-----------------------------+
| VisualVault | redirect| Audit Application |
| | -------> | (Express, Node.js) |
| [ Menu Item: ERM] | | |
| URL + ?userLoginToken=... | | Validates tokens via |
| + &authToken=... | | /Services/serverstrings.js |
| | | and configvariables.js |
+-------------------------------+ +-----------------------------+Data Flow
📋 Coming Soon: A diagram illustrating API call endpoints and data flow between the Audit Application, VisualVault APIs, and the SQL data sources will be added here.
Views and Partials
The server serves views using the URL path /views/<view_name>.html (e.g., localhost:89/views/index.html loads index.html). The app includes partial views using HTML includes such as include partials/head.
The application uses a single-page design (SPA) with dynamic view swapping controlled by index.html. JavaScript sets the base URL dynamically using the head.html partial and manages core functionality including authentication and Kendo grid initialization.
javascript
// PROD
// var appBaseUrl = 'https://vv5dev.visualvault.com';
// Local machine
var appBaseUrl = 'https://localhost:89';Controllers and Routes
Routes use Express to connect API calls to controller functions. GET requests fetch data based on query parameters; POST requests submit data to filter or create documents.
javascript
// Controller Routes
// TODO - add middleware for bearer token authentication here
var documentsController = require('./controllers/documentsController.js');
app.get('/api/documents', documentsController.findAll);
app.post('/api/documents', documentsController.findAll);
app.post('/api/documents/authenticate', documentsController.authenticate);
app.get('/api/documents/authenticate', documentsController.authenticate);Models and Data Fetching
Models interact with data sources including SQL databases and VisualVault APIs. Data retrieval is performed via JavaScript promises using SQL queries or VisualVault's API. The controller passes request parameters to the model, which constructs the SQL query or calls VisualVault APIs for data. Results are returned as JSON objects consumed by the front end to update the Kendo grid and interface dynamically.
Configuration Parameters
/Services/configvariables.js
Parameter | Description |
|---|---|
| List of auditor names used for role-based filtering |
| Enumeration of document types available in the application |
| Document types that may be requested during an audit |
| List of leaders used for access scoping |
| Types of surveys supported by the application |
/Services/serverstrings.js
Parameter | Description |
|---|---|
| API key for VisualVault authentication |
| Customer alias for the VisualVault environment |
| Developer ID for API access |
| Developer secret for API access |
| Database alias within VisualVault |
| Base URL of the target VisualVault instance |
| Template identifier for individual audit records |
| Key used to validate session tokens |
| SQL database username |
| SQL database password |
| Target SQL database name |
| SQL server hostname |
| SQL multi-subnet failover setting |
| Flag to enable or disable SQL connectivity |
Implemenation Guide
Step 1 — Configure Client and Server Variables
Open
/Services/configvariables.jsand populate the following constants with environment-appropriate values:Auditor_Names_ListDocument_Types_ListDocument_Types_Requested_ListLeader_Name_ListSurvey_Type_List
Open
/Services/serverstrings.jsand populate all required variables. Refer to the Configuration Parameters section for a full description of each field.
Step 2 — Deploy to the Pre-Production VisualVault Environment
Define the required VisualVault custom SQL queries:
Navigate to VisualVault → Control Panel → Enterprise Tools.
Click Data Connections and configure the required queries.
Push the application code to the VisualVault pre-production environment.
Set all required environment variables in the deployment environment.
Step 3 — Test the Deployed Application
Test all Express API endpoints to confirm the API is functioning correctly.
Monitor application logs for errors and resolve any issues before proceeding to production.
🔧 Implementor Checklist
Configure the client and server variables in
/Services/configvariables.jsand/Services/serverstrings.jsDefine custom SQL queries in VisualVault Control Panel under Enterprise Tools → Data Connections
Deploy application code with configured environment variables
Verify application is accessible from the VisualVault landing page
Execution Flow
The following describes the runtime sequence from user access through document retrieval.
Application Initialization
User navigates to the VisualVault login page and authenticates.
User accesses the Audit screen via the left side menu on the landing page.
VisualVault appends the user login token and authentication token to the application URL.
The Node.js app reads the tokens, validates the user's identity, and renders the application UI.
The app makes an initial API call to VisualVault to determine role-based access and renders the interface conditionally based on the user's group membership.
🔍 Troubleshooting Note: If the app fails to load or displays an authentication error, verify that the user login token and authentication token are correctly appended to the Content URL in the Page Viewer widget. Also confirm that
AUTH_VAULT_URLand all token-related variables in/Services/serverstrings.jsare correctly set for the target environment.
Document Search
In the search screen, enter an employee name in the search field.
Press Enter or click the Search button to execute the query.
The application submits the search to
/api/documentsand retrieves matching records.Results are displayed in the Kendo UI grid, which includes the following fields:
Column / Field
Description
Employee Name
Full name of the matching employee
Employee Number
Unique identifier for the employee record
Document Type
Category of the associated document
Actions
Links to open documents in the VisualVault document viewer
Use the Kendo grid's built-in pagination and sorting controls to navigate large result sets.
Click a document link to open it in the integrated VisualVault document viewer.
Optionally, use the Export to Excel toolbar button to download the grid data as an Excel file.
🔍 Troubleshooting Note: If search results are missing or incorrect, confirm that the custom SQL queries are correctly defined in VisualVault → Control Panel → Enterprise Tools → Data Connections, and that the user's role-based permissions are correctly configured to scope their visible records.
Related Resources
Github Repository: HRSurvey (private)
Related Articles
