# sfdo-community-sprints/uk-housing-email2record architecture

> Architecture diagram of the GitHub repository sfdo-community-sprints/uk-housing-email2record, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sfdo-community-sprints/uk-housing-email2record
- Repository: https://github.com/sfdo-community-sprints/uk-housing-email2record

## Overview

AHA Email to Record is a Salesforce application that turns inbound email into an actionable record, then enriches it with structured fields through an Agentforce Prompt Template. The documented path runs from the Email Service and Apex parser through a record-triggered Flow to the prompt and back to the record; users access records through the E2R tab and Lightning page. The tree also contains Document AI Apex classes, but the available README excerpt does not describe their runtime relationships, so those are shown as an unconnected subsystem.

Main entry points: [`force-app/main/default/flows/aha_E2R_Record_Populate_from_Email.flow-meta.xml`](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/flows/aha_E2R_Record_Populate_from_Email.flow-meta.xml) (Email enrichment Flow), [`force-app/main/default/objects/aha_E2R_Record__c/aha_E2R_Record__c.object-meta.xml`](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/objects/aha_E2R_Record__c/aha_E2R_Record__c.object-meta.xml) (E2R record), [`force-app/main/default/emailservices/aha_E2R_Emails.xml-meta.xml`](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/emailservices/aha_E2R_Emails.xml-meta.xml) (Email Service), [`force-app/main/default/classes/aha_E2R_EmailParser.cls`](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/classes/aha_E2R_EmailParser.cls) (Email parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Email intake"]
  node_email_service["Email Service"]
  node_email_parser["Email parser"]
end

subgraph group_enrichment["AI enrichment"]
  node_populate_flow["Email enrichment Flow"]
  node_prompt["Email prompt template"]
  node_lightning_type["Response type<br/>[schema.json]"]
end

subgraph group_records["Records and access"]
  node_record[("E2R record")]
  node_record_fields["Record fields"]
  node_record_queue["Records queue"]
  node_record_panel["Record panel Flow"]
  node_record_page["Lightning record page"]
  node_record_tab["E2R Records tab"]
end

subgraph group_document_ai["Document AI"]
  node_doc_extractor["Document AI extractor"]
  node_doc_queueable["Document AI queueable"]
end

node_sender(("Email sender"))
node_user(("Salesforce user"))

node_sender -->|"sends email"| node_email_service
node_email_service -->|"invokes handler"| node_email_parser
node_email_parser -->|"creates record"| node_record
node_record -->|"triggers enrichment"| node_populate_flow
node_populate_flow -->|"sends email body"| node_prompt
node_prompt -->|"formats response"| node_lightning_type
node_populate_flow -->|"populates fields"| node_record_fields
node_record -->|"owned by"| node_record_queue
node_user -->|"opens records"| node_record_tab
node_record_tab -->|"displays record"| node_record_page
node_record_page -.->|"hosts panel"| node_record_panel

click node_email_service "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/emailservices/aha_E2R_Emails.xml-meta.xml"
click node_email_parser "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/classes/aha_E2R_EmailParser.cls"
click node_record "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/objects/aha_E2R_Record__c/aha_E2R_Record__c.object-meta.xml"
click node_record_fields "https://github.com/sfdo-community-sprints/uk-housing-email2record/tree/main/force-app/main/default/objects/aha_E2R_Record__c/fields"
click node_populate_flow "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/flows/aha_E2R_Record_Populate_from_Email.flow-meta.xml"
click node_prompt "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/genAiPromptTemplates/aha_E2R_Record_Email.genAiPromptTemplate-meta.xml"
click node_lightning_type "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/lightningTypes/ahaE2RRecordOBLTv1/schema.json"
click node_record_queue "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/queues/aha_E2R_Records.queue-meta.xml"
click node_record_panel "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/flows/aha_E2R_Record_Panel.flow-meta.xml"
click node_record_page "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/flexipages/aha_E2R_Record_Record_Page.flexipage-meta.xml"
click node_record_tab "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/tabs/aha_E2R_Record__c.tab-meta.xml"
click node_doc_extractor "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/classes/aha_E2R_DocumentAIExtractor.cls"
click node_doc_queueable "https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/classes/aha_E2R_DocumentAIQueueable.cls"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_email_service,node_email_parser,node_user toneBlue
class node_populate_flow,node_prompt,node_lightning_type toneAmber
class node_record,node_record_fields,node_record_queue,node_record_panel,node_record_page,node_record_tab toneMint
class node_doc_extractor,node_doc_queueable toneRose
class node_sender toneIndigo
```

## Components

### Email intake

- [Email Service](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/emailservices/aha_E2R_Emails.xml-meta.xml): `force-app/main/default/emailservices/aha_E2R_Emails.xml-meta.xml`
- [Email parser](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/classes/aha_E2R_EmailParser.cls): `force-app/main/default/classes/aha_E2R_EmailParser.cls`

### AI enrichment

- [Email enrichment Flow](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/flows/aha_E2R_Record_Populate_from_Email.flow-meta.xml): `force-app/main/default/flows/aha_E2R_Record_Populate_from_Email.flow-meta.xml`
- [Email prompt template](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/genAiPromptTemplates/aha_E2R_Record_Email.genAiPromptTemplate-meta.xml): `force-app/main/default/genAiPromptTemplates/aha_E2R_Record_Email.genAiPromptTemplate-meta.xml`
- [Response type](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/lightningTypes/ahaE2RRecordOBLTv1/schema.json): `force-app/main/default/lightningTypes/ahaE2RRecordOBLTv1/schema.json`

### Records and access

- [E2R record](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/objects/aha_E2R_Record__c/aha_E2R_Record__c.object-meta.xml): `force-app/main/default/objects/aha_E2R_Record__c/aha_E2R_Record__c.object-meta.xml`
- [Record fields](https://github.com/sfdo-community-sprints/uk-housing-email2record/tree/main/force-app/main/default/objects/aha_E2R_Record__c/fields): `force-app/main/default/objects/aha_E2R_Record__c/fields`
- [Records queue](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/queues/aha_E2R_Records.queue-meta.xml): `force-app/main/default/queues/aha_E2R_Records.queue-meta.xml`
- [Record panel Flow](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/flows/aha_E2R_Record_Panel.flow-meta.xml): `force-app/main/default/flows/aha_E2R_Record_Panel.flow-meta.xml`
- [Lightning record page](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/flexipages/aha_E2R_Record_Record_Page.flexipage-meta.xml): `force-app/main/default/flexipages/aha_E2R_Record_Record_Page.flexipage-meta.xml`
- [E2R Records tab](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/tabs/aha_E2R_Record__c.tab-meta.xml): `force-app/main/default/tabs/aha_E2R_Record__c.tab-meta.xml`

### Document AI

- [Document AI extractor](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/classes/aha_E2R_DocumentAIExtractor.cls): `force-app/main/default/classes/aha_E2R_DocumentAIExtractor.cls`
- [Document AI queueable](https://github.com/sfdo-community-sprints/uk-housing-email2record/blob/main/force-app/main/default/classes/aha_E2R_DocumentAIQueueable.cls): `force-app/main/default/classes/aha_E2R_DocumentAIQueueable.cls`

### Other components

- **Email sender**
- **Salesforce user**

## Connections

- Email sender → Email Service: sends email (evidence: `README.md`)
- Email Service → Email parser: invokes handler (evidence: `README.md`)
- Email parser → E2R record: creates record (evidence: `README.md`)
- E2R record → Email enrichment Flow: triggers enrichment (evidence: `README.md`)
- Email enrichment Flow → Email prompt template: sends email body (evidence: `README.md`)
- Email prompt template → Response type: formats response (evidence: `README.md`)
- Email enrichment Flow → Record fields: populates fields (evidence: `README.md`)
- E2R record → Records queue: owned by (evidence: `README.md`)
- Salesforce user → E2R Records tab: opens records (evidence: `README.md`)
- E2R Records tab → Lightning record page: displays record (evidence: `README.md`)
- Lightning record page → Record panel Flow: hosts panel
