Sales teams struggle with:
- Leads coming from multiple sources with no unified view
- Duplicated contact data polluting the CRM
- Missed follow-ups due to no intelligent prioritization
- CRM data sitting idle — not used for analytics or AI
This platform solves it by building a real-time, AI-powered lead management system that syncs Salesforce CRM data with Google services, scores leads automatically, and triggers smart follow-up actions.
Salesforce Lead Created
│
▼
Platform Event Published
│
▼
Queueable Apex (async)
│
▼ REST callout (OAuth2 / Named Credential)
Google Cloud Function
│
├──► BigQuery (store lead data)
│
└──► Vertex AI (score lead)
│
▼
Callback → Salesforce REST Endpoint
│
├──► Update AI_Score__c
├──► Auto-create Task
└──► Google Calendar Event + Gmail Draft
- Apex (Queueable, Batchable, REST)
- Platform Events
- Named Credentials (OAuth2)
- Custom Metadata (config)
- Lightning Web Components (dashboard)
- Custom Logging Framework
- Cloud Functions (HTTP triggered)
- BigQuery (data warehouse)
- Vertex AI (lead scoring)
- Google Calendar API
- Gmail API
/salesforce
/classes → Apex classes
/triggers → Apex triggers
/objects → Custom object metadata
/lwc → Lightning Web Components
/customMetadata → Config records
/google-cloud
/functions → Cloud Function source code
/bigquery → Schema definitions
/vertex → AI model config
/docs
/diagrams → Architecture, sequence, ER diagrams
/decisions → Engineering decision records
| Field Label | API Name | Type | Purpose |
|---|---|---|---|
| AI Score | AI_Score__c |
Number | Score returned by Vertex AI (0–100) |
| Sync Status | Sync_Status__c |
Picklist | Pending / Synced / Failed |
| Duplicate Flag | Duplicate_Flag__c |
Checkbox | Flagged by deduplication engine |
| External ID | External_Id__c |
Text | Idempotency key for external systems |
| Retry Count | Retry_Count__c |
Number | Tracks callout retry attempts |
| Last Sync Timestamp | Last_Sync_Timestamp__c |
DateTime | When last synced to Google Cloud |
- Queueable supports chaining (job A → job B → job C)
- Supports complex object types as parameters
- Better error handling and monitoring via AsyncApexJob
- Decouples trigger logic from external integration
- Survives transaction rollbacks (events are published even if DML fails)
- Enables microservice-style architecture inside Salesforce
- All SOQL queries use Maps for O(1) lookups
- No SOQL or DML inside loops
- Bulk-safe: all code processes List not single records
- Callouts batched and chunked to respect limits
- Each outbound request carries a unique
correlation_id - Prevents duplicate processing if retried
| Week | Focus |
|---|---|
| Week 1 | Salesforce core — data model, trigger framework, async pipeline, logging |
| Week 2 | Google Cloud — Cloud Function, BigQuery, simulated AI scoring |
| Week 3 | Intelligence — dedup engine, Google Workspace, retry strategy |
| Week 4 | UI, documentation, demo, polish |
(Will be updated as each phase is completed)
- Deploy Salesforce metadata using SF CLI
- Configure Named Credential with Google Cloud OAuth2
- Deploy Cloud Function to GCP
- Update Custom Metadata with live endpoint URL
- Assign permission sets to users