Email Document Processing Workflow
Complete guide: How emails become forms and documents in the system
Email Arrives
Contractor sends email:
To: timesheets@yourcompany.com (or configured email)
From: contractor@email.com
Subject: "Timesheet for 12/15/2024"
Body: "Worked 8 hours at Memorial Hospital..."
Attachments: timesheet.pdf, signed_form.pdf
⚡ Automatic: Email forwarding rule or integration captures this email
Stored in EmailProcessingQueue
System creates record:
{
"from_email": "contractor@email.com",
"to_email": "timesheets@yourcompany.com",
"subject": "Timesheet for 12/15/2024",
"body_text": "Worked 8 hours...",
"attachments": [
{ "filename": "timesheet.pdf", "file_url": "..." }
],
"processing_status": "pending",
"needs_review": true
}
Entity
Status
Admin Accesses via Multiple Routes
Admin can access these email documents from 3 different places:
📍 Contractor Information Center → Email Docs Tab
- ✅ See all emails for specific contractor
- ✅ Process alongside other contractor data
- ✅ Full context (documents, forms, timesheets)
- ✅ Best for contractor-focused workflow
📧 Email Inbox (Dedicated Page)
- ✅ See ALL pending emails from all contractors
- ✅ Bulk processing workflow
- ✅ Filter by status, date, contractor
- ✅ Best for email-focused workflow
📊 Unified Admin Dashboard
- ✅ Overview of all pending items
- ✅ Quick access to emails + forms + documents
- ✅ Best for overview and prioritization
Admin Reviews Email
Admin clicks on email and sees:
Email Details
From: contractor@email.com
Subject: Timesheet for 12/15/2024
Body: Full email content...
Attachments
Admin has 2 options:
1️⃣ Auto-process with AI (recommended)
2️⃣ Manually enter data
Processing: Auto vs Manual
Option A: Auto-Process with AI ⚡
1️⃣ Admin clicks "Auto-Process with AI"
→ System sends email + attachments to AI
→ AI analyzes content and extracts structured data
→ AI identifies: contractor, dates, hours, facility, etc.
2️⃣ AI Returns Extracted Data
{
"contractor_email": "contractor@email.com",
"work_date": "2024-12-15",
"hours_worked": 8,
"facility_name": "Memorial Hospital",
"clock_in": "09:00",
"clock_out": "17:00"
}
3️⃣ System Finds Matching Form
→ Searches for form matching the data type
→ Uses first available form if no exact match
✅ Result: Auto-Created Records
✓ FormSubmission created (status: approved)
✓ Document created (if attachment exists)
✓ EmailProcessingQueue updated (status: completed)
Option B: Manual Entry 📝
1️⃣ Admin selects form type
2️⃣ Admin fills in fields manually
• Contractor: [Select from dropdown]
• Work Date: [Enter date]
• Hours: [Enter hours]
• Facility: [Select facility]
✅ Result: Manual Records Created
✓ FormSubmission created (status: approved)
✓ Document created (if attachment exists)
✓ EmailProcessingQueue updated (status: completed)
Data Stored in Multiple Places
The processed email creates records in:
FormSubmission
Structured form data extracted from email
form_id: [matched form]
applicant_email: contractor@email.com
form_data: {extracted fields}
status: approved
notes: "From email: [subject]"
Document
PDF attachments from the email
applicant_email: contractor@email.com
document_type: [auto-detected]
file_url: [attachment URL]
status: approved
notes: "From email: [subject]"
EmailProcessingQueue (Updated)
Original email record updated with results
processing_status: completed ✅
extracted_data: {stored for audit}
created_timesheet_id: [form submission ID]
processed_date: [timestamp]
processed_by: admin@company.com
Data Now Available Everywhere
The processed data is now accessible from:
Contractor Information Center → Forms Tab
View, edit, print PDF, delete
Contractor Information Center → Documents Tab
View PDFs, edit status, delete
Manage Submissions Page
All form submissions across all contractors
Reports & Analytics
Include in custom reports and exports
Contractor View (if forms are public)
Contractor can see their submitted forms
🔄 Real-Time Sync
Changes made in one place update everywhere instantly. Edit a form in Contractor Information Center? It updates in Manage Submissions immediately.
Option 1: Manual Entry (Available Now)
Admin can manually add email documents through the "Add Email Document" button in Contractor Information Center.
📍 Path: Contractor Information Center → Select Contractor → Email Docs tab → "Add Email Document"
Option 2: Email Forwarding (Recommended)
Set up email forwarding rule in your email provider:
- 1. Create a dedicated email (e.g., timesheets@yourcompany.com)
- 2. Set up forwarding rule to API endpoint
- 3. Configure webhook to create EmailProcessingQueue records
- 4. Emails automatically appear in the system
Option 3: Email Integration Service
Use services like Zapier, Make.com, or SendGrid to:
- • Monitor inbox for new emails
- • Parse email content and attachments
- • Create records via base44 API
📧 Email Storage
All emails stored here first
📝 Form Storage
Processed data stored as forms
📄 Document Storage
PDF attachments stored here
⚡ Processing Flow
Email → Queue → Admin Review → AI Extract → Create Form + Document → Available Everywhere