Version: 2.0.0 | Author: Alvaro Gomez | Project Lead: Wendy Gomez
Automated email notification system that processes Google Form submissions and sends counselor requests to appropriate staff members based on student information and request urgency levels.
Description: Main form submission handler and email dispatcher. Processes Google Form submissions, validates data, determines appropriate counselor routing, sends email notifications, and updates spreadsheet checkboxes.
{Object} e
- Form submission event object from Google Forms{Array<string>} e.values
- Array of form response values
{Error}
When counselor email mapping is not found{Error}
When form validation fails
const mockEvent = { values: ['timestamp', 'student@email.com', 'Gomez (Cas-Fl)', '12345', 'Doe', 'John'] }; onFormSubmit(mockEvent);
Description: Adds checkboxes to column K starting in row 2 for specified counselor sheets. Iterates through predefined counselor sheet names and adds checkboxes for tracking completed requests.
{Error}
When spreadsheet access fails or sheet operations error
// Called automatically on form submission addCheckboxesToCounselorSheets();
Description: Validates the form submission event to ensure it contains required data.
{Object} e
- Form submission event object
{boolean}
True if valid, false otherwise
Description: Validates required form data fields including firstName, lastName, counselorName, and reason.
{Object} formData
- Parsed form data
{boolean}
True if valid, false otherwise
Description: Parses form data into a structured object with named properties instead of array indices.
{Array} values
- Form response values
{Object}
Parsed form data with structured properties
Description: Composes the email subject and body with improved formatting and clear sections.
{Object} formData
- Parsed form data
{Object}
Email data with subject and body properties
Description: Sends regular email to specific counselor with both plain text and HTML formatting.
{Object} emailData
- Email subject and body{string} counselorEmail
- Target counselor email address
Description: Sends emergency email to all counselors when urgent requests are submitted.
{Object} emailData
- Email subject and body{Array} allEmails
- Array of all counselor email addresses
Description: Determines if the request is an emergency requiring all counselors to be notified.
{Object} formData
- Parsed form data
{boolean}
True if emergency, false otherwise
Description: Builds reason-specific email content with better formatting for different request types.
{Object} formData
- Parsed form data
{string}
Formatted reason-specific content
Description: Sends error notification email to administrator when script execution fails.
{Error} error
- The error object to report
Description: Main configuration object containing admin email, form column indices, and system settings.
CONFIG = { ADMIN_EMAIL: 'alvaro.gomez@nisd.net', EMAIL_SUBJECT: 'REQUEST TO SEE COUNSELOR', EMERGENCY_URGENCY: 'Red (It is an emergency...)', FORM_COLUMNS: { STUDENT_EMAIL: 1, COUNSELOR_NAME: 2, STUDENT_ID: 3, // ... more columns } }
Description: Email mapping configuration with separate PRODUCTION and TESTING environments.
// Switch between environments const counselorEmails = COUNSELOR_EMAILS.TESTING; // or .PRODUCTION
Description: Predefined constants for counselor request reason types to ensure consistency.
REASON_TYPES = { ACADEMIC: 'Academic (4 Year Planning...)', SCHEDULING: 'Scheduling Concerns...', PERSONAL: 'Personal Issues', COLLEGE_CAREER: 'College & Career Planning...', OTHER: 'Other' }
Generated on July 26, 2025 | Clark Counselor Notification System v2.0.0