Urla Shoes — AI document-compliance engine + multi-feature Salesforce platform
A multi-feature Salesforce build led by an AI Partner Compliance Document Manager: an Einstein Prompt Template (Prompt Builder, GPT-4o mini) classifies each uploaded partner document into structured JSON, validates it, and auto-closes the matching compliance request. Around it: route-safety AI (Google Maps + OpenWeather + Einstein), Contact enrichment, Lead Queue routing, Loan Sync, a Reseller Matching engine, and a Custom-Setting-backed API key layer that keeps secrets out of source.
- Year
- 2024
- Role
- Salesforce Developer
- Tech stack
- Apex (Queueable, Schedulable)Lightning Web ComponentsVisualforce (bridge)Salesforce EinsteinEinstein Prompt Templates (Prompt Builder)AI document classification (GenAI)Agentforce actions (@InvocableMethod)Notion APICustom Metadata TypesConnectApi.EinsteinLLMTrigger Framework (Kevin O'Hara)Custom Settings (hierarchical)Platform EventsCustom ObjectsHttpCalloutMockRemote Site Settings
Highlights
- AI Partner Compliance Document Manager — an Einstein Prompt Template (Prompt Builder, GPT-4o mini via ConnectApi.EinsteinLLM, Trust Layer) classifies each upload into structured JSON (category, confidence, expiry), validates it, writes it back, and auto-closes the matching document request
- Compliance Cockpit — a live MISSING/EXPIRED/EXPIRING/OK matrix with per-partner scores, driven by Custom Metadata requirements (Tax Certificate, Insurance, Signed Contract, Bank Details)
- Agentforce invocable actions (@InvocableMethod) — LeadQualificationService scores + rates leads (Hot/Warm/Cold) with a DACH bonus (DE/AT/CH) and auto-creates a call task; OnboardReseller derives tier (Platinum/Gold/Silver) + commission and spins up Account + Contact + Opportunity + Quote
- Magic-link partner self-registration — unmatched resellers get a single-use, 7-day tokenized link; an @InvocableMethod reconciliation action later back-links them to every unmatched opportunity by email domain
- Notion API integration — programmatic STAR-format pages (block-JSON, language-token alias map, 2000-char rich-text chunking) from a protected Custom Setting token
- Route Safety LWC — Google Maps + 5-waypoint parallel OpenWeather + Einstein Prompt Template AI verdict in one screen
- Contact Enrichment Queueable — Nationalize.io with HttpCalloutMock across 6 scenarios (success, empty, HTTP 500, missing FirstName, bulk-10, parser test)
- Shift-based lead-routing engine — round-robin by lowest load with per-shift capacity, 5-min SLA deadlines that reclaim breaches (SLA_Breach_Log__c) and re-distribute excluding the breaching reps, timezone/DST-correct windows incl. overnight shifts; scheduled batch + Lead_Shift_Event__e Platform Event + LWC dashboard
- Loan Sync Pipeline — Loan__c + Loan_Sync_Log__c custom objects + Opportunity-triggered sync + retry scheduler with audit logging
- Reseller Matching Engine — multi-criteria scoring + Opportunity trigger + LWC tier badge
- Platform foundations — extensible Kevin O'Hara TriggerHandler framework, round-robin task assignment, SLA expiry automation
- Senior pattern: API keys served from API_Config__c Custom Setting via ApiKeyService Apex helper — no secrets in source
Feature walkthrough
Partner Compliance Cockpit
A network-wide matrix scores every reseller's required documents at a glance — MISSING / EXPIRED / EXPIRING / OK — with per-partner compliance percentages and roll-up counts (fully compliant, expiring soon, at risk). The required documents are defined in Custom Metadata, so an admin can change the ruleset without a code deploy.

AI Document Classifier (Einstein / GPT-4o mini)
Each uploaded document is analysed on demand: an Einstein Prompt Template classifies it into a category with a confidence score, extracts its expiry date, and writes a one-line summary — then applies the result to the record. Here the model files a distribution contract (95%), a tax certificate (90%) and an insurance certificate (90%) automatically.

Live scoring & auto-fulfilled document requests
On each reseller record, a scored checklist reflects document status in real time via Lightning Message Service — no page reload. 'Request Missing Documents' raises a Document_Request__c and emails the partner's primary contact; once the matching document is classified, the request auto-closes and the score climbs from 25% to 100%.

File Hub — Partner Document Center
A business layer over Salesforce's native ContentDocument storage that adds sender, recipient, category and record-link semantics, with colour-coded category tiles and a monthly activity heatmap. Private sharing via Apex-managed shares, ghost-record protection on deletion, and FLS/CRUD enforced with WITH USER_MODE (~91% controller coverage).

Shift-based lead-routing engine
Inbound leads are routed to reps in active, timezone-aware shifts using capacity-aware round-robin (lowest load wins). A 5-minute SLA reclaims un-actioned leads, logs an SLA_Breach_Log__c audit record and re-distributes them while excluding the breaching rep. A Platform Event feeds the live dashboard — a 24-hour global timeline and a champion board — with no polling.

Loan creation & sync pipeline
A Closed-Won opportunity mints a Loan record and syncs it to a core system via a Queueable HTTP callout — one callout per batch even on bulk inserts. Every attempt is logged to Loan_Sync_Log__c with the request/response payload; a retry ceiling plus a 'Retry Now' action make it resilient and auditable.

Route & Weather Navigator (AI safety verdict)
A Google Maps driving route (Essen → destination) with live weather at five interpolated waypoints, ending in a three-sentence Einstein AI safety verdict (safe / caution / do not depart). Google Maps runs inside a Visualforce page bridged to the LWC via postMessage — the standard workaround for Lightning Web Security.

The problem
I needed a single Salesforce project that demonstrated platform breadth — multiple integration patterns, async Apex flavours, AI integration, custom data models, and the kind of secrets-out-of-source discipline that production orgs require. A single-feature demo wouldn't show how engineering decisions compose across an org.
Architecture
The flagship is an AI Partner Compliance Document Manager. When a partner uploads a file to the File Hub, DocumentIntelligenceService builds a context string (file name, type, sender note, reseller, the live category taxonomy and which categories carry an expiry) and invokes an Einstein Prompt Template ('DocumentClassification', GPT-4o mini) through the Trust Layer via ConnectApi.EinsteinLLM.generateMessagesForPromptTemplate. The model returns strict JSON — category, confidence (0–100), an extracted expiry date, and a summary — which the service validates against the allowed picklist, writes back onto the File_Hub_Entry__c, and uses to auto-close any matching Document_Request__c; compliance requirements live in Custom Metadata (Tax Certificate, Insurance, Signed Contract, Bank Details), so ComplianceService computes a live MISSING/EXPIRED/EXPIRING/OK matrix and a per-partner score (the Compliance Cockpit), all FLS/CRUD-enforced (WITH USER_MODE) with @TestVisible LLM mocking. A second AI feature is the routeWeather LWC — a three-integration composition. It hosts a Visualforce page (RouteMapPage) in an iframe (the only way to load Google Maps under Lightning Web Security) and communicates via postMessage: the LWC sends DRAW_ROUTE, the page responds with ROUTE_DONE plus the destination coordinates. The LWC then computes five waypoints (origin, 25 %, midpoint, 75 %, destination) and fires five parallel fetches to OpenWeatherMap via Promise.all. Once weather lands, the LWC POSTs a slim six-field-per-waypoint payload to the Apex RouteWeatherAnalysisService, which formats the data as text and invokes ConnectApi.EinsteinLLM.generateMessagesForPromptTemplate('RouteWeatherAnalysis', input). The GPT-4o mini response is rendered in a colour-coded card by a keyword classifier (storm/ice/hazard → red; caution/careful → amber; otherwise green). Around that headline sits a Lead Queue routing system (LeadQueueScheduler scheduled batch + Lead_Shift_Event__e Platform Event + leadShiftDashboard LWC), a Loan Sync Pipeline (Loan__c + Loan_Sync_Log__c custom objects with retry scheduler and audit logging), a Reseller Matching Engine (multi-criteria scoring service + Opportunity trigger + resellerTierBadge LWC), and an extensible TriggerHandler framework that every trigger in the org extends.
The approach
Three principles run through every feature. First, async by default — every external callout uses Queueable or Schedulable, no synchronous trigger callouts, no governor surprises under load. Second, secrets out of source — both the Google Maps and OpenWeather API keys live in an API_Config__c hierarchical Custom Setting, read at runtime via an ApiKeyService Apex class (instance property for VF, @AuraEnabled cacheable methods for LWC). The Visualforce page renders the Maps key via {!JSENCODE(mapsApiKey)} so it never appears as a literal in source; the LWC awaits getOpenWeatherApiKey() in connectedCallback. ApiKeyServiceTest gives 100 % coverage. Third, every trigger extends the same Kevin O'Hara TriggerHandler base — recursion guards, bypass mechanism, testable logic — so the routing, sync, matching, and contact-enrichment features all behave consistently under bulk load.
The outcome
A reference Salesforce sandbox built end-to-end (private repo; walkthrough on request). Its flagship is an autonomous AI document-compliance loop (Einstein Prompt Templates / Prompt Builder, structured-JSON classification, auto-fulfilled requests); around it sit route-safety AI, Contact enrichment, Lead Queue routing, Loan Sync, and a Reseller Matching engine — across LWC, Apex, Visualforce, custom objects, Custom Metadata, Platform Events, scheduled batches, and Einstein AI. The senior-engineering details (key management via Custom Setting, trigger framework, async-by-default, FLS/CRUD with USER_MODE, mocked LLM tests) are visible in the diff. The same patterns transfer directly to the multi-feature Salesforce orgs that mid-to-large DACH companies actually run.
External integrations
- Google Maps Directions
Route geometry via VF iframe + postMessage; key from Custom Setting
- OpenWeatherMap
5-waypoint parallel forecast; key from Custom Setting
- Salesforce Einstein (GPT-4o mini)
Prompt Template safety assessment via ConnectApi.EinsteinLLM
- Nationalize.io
Contact country prediction on insert (Queueable + 6-scenario mock)