From 516e55519a3d65d4eb8859e16e9368172ad94fba Mon Sep 17 00:00:00 2001 From: Alexa Louise Date: Sun, 11 Jan 2026 18:41:38 -0600 Subject: [PATCH] Add General CRM + Agency CRM automation and dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Lead-to-Deal Conversion Flow (screen flow) - Add Policy Renewal Reminder Flow (scheduled, draft) - Add Commission Auto-Calculate Flow (record-triggered, draft) - Add BlackRoad CRM Dashboard (Lightning App Page) - Add sample data loader scripts for all 3 CRMs - Update permission sets with new object access 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- ...BlackRoad_CRM_Dashboard.flexipage-meta.xml | 54 ++++++ .../Commission_Auto_Calculate.flow-meta.xml | 172 ++++++++++++++++++ ...sehold_Create_Compliance_Log.flow-meta.xml | 2 +- .../Lead_to_Deal_Conversion.flow-meta.xml | 100 ++++++++++ .../flows/Liquidity_Event_Alert.flow-meta.xml | 2 +- .../Mortality_Event_Workflow.flow-meta.xml | 2 +- .../Policy_Renewal_Reminder.flow-meta.xml | 166 +++++++++++++++++ ...BlackRoad_Hub_Admin.permissionset-meta.xml | 160 ++++++++++++++++ scripts/apex/loadAllSampleData.apex | 11 +- scripts/apex/minimalDataLoader.apex | 22 +++ scripts/apex/simpleDataLoader.apex | 65 +++++++ scripts/apex/testNewCRMs.apex | 38 ++++ 12 files changed, 786 insertions(+), 8 deletions(-) create mode 100644 force-app/main/default/flexipages/BlackRoad_CRM_Dashboard.flexipage-meta.xml create mode 100644 force-app/main/default/flows/Commission_Auto_Calculate.flow-meta.xml create mode 100644 force-app/main/default/flows/Lead_to_Deal_Conversion.flow-meta.xml create mode 100644 force-app/main/default/flows/Policy_Renewal_Reminder.flow-meta.xml create mode 100644 scripts/apex/minimalDataLoader.apex create mode 100644 scripts/apex/simpleDataLoader.apex create mode 100644 scripts/apex/testNewCRMs.apex diff --git a/force-app/main/default/flexipages/BlackRoad_CRM_Dashboard.flexipage-meta.xml b/force-app/main/default/flexipages/BlackRoad_CRM_Dashboard.flexipage-meta.xml new file mode 100644 index 0000000..290c513 --- /dev/null +++ b/force-app/main/default/flexipages/BlackRoad_CRM_Dashboard.flexipage-meta.xml @@ -0,0 +1,54 @@ + + + BlackRoad Hub - Multi-CRM Dashboard + + + + + richTextValue + <h1 style="text-align: center;"><b>BlackRoad OS Hub - CRM Dashboard</b></h1> +<p style="text-align: center;">Your unified command center for Financial Advisor, General, and Agency CRM products</p> +<hr/> +<h2>Financial Advisor CRM</h2> +<p>Manage high-net-worth client households, financial accounts, and wealth planning.</p> +<ul> +<li><b>Client Households</b> - Track AUM, risk profiles, review schedules</li> +<li><b>Financial Accounts</b> - Monitor portfolio positions by custodian</li> +<li><b>Liquidity Events</b> - IPO, M&amp;A, and business sale planning</li> +<li><b>Mortality Events</b> - Estate processing workflows</li> +<li><b>Compliance Logs</b> - FINRA audit trail</li> +</ul> +<hr/> +<h2>General CRM</h2> +<p>Track leads, companies, deals, and sales pipeline.</p> +<ul> +<li><b>Leads</b> - Capture and qualify prospects</li> +<li><b>Companies</b> - Manage business accounts</li> +<li><b>Deals</b> - Track opportunities through pipeline</li> +<li><b>Activities</b> - Log calls, emails, meetings</li> +<li><b>Tasks</b> - Manage follow-ups and action items</li> +</ul> +<hr/> +<h2>Agency CRM</h2> +<p>Manage agents, clients, policies, listings, and commissions.</p> +<ul> +<li><b>Agents</b> - Track agent performance and territories</li> +<li><b>Clients</b> - Manage agency client relationships</li> +<li><b>Policies</b> - Insurance and coverage tracking</li> +<li><b>Listings</b> - Property and asset inventory</li> +<li><b>Commissions</b> - Calculate and track payouts</li> +</ul> + + flexipage:richText + flexipage_richText_dashboard + + + main + Region + + BlackRoad CRM Dashboard + + AppPage + diff --git a/force-app/main/default/flows/Commission_Auto_Calculate.flow-meta.xml b/force-app/main/default/flows/Commission_Auto_Calculate.flow-meta.xml new file mode 100644 index 0000000..ae48d50 --- /dev/null +++ b/force-app/main/default/flows/Commission_Auto_Calculate.flow-meta.xml @@ -0,0 +1,172 @@ + + + 59.0 + Automatically creates commission records when a listing is sold or policy is activated + Commission Auto Calculate {!$Flow.CurrentDateTime} + + + BuilderType + + LightningFlowBuilder + + + AutoLaunchedFlow + DefaultMode + + 50 + 0 + + Check_If_Sold + + and + + Listing_Status__c + EqualTo + + Sold + + + + Agent__c + IsNull + + false + + + Listing__c + CreateAndUpdate + RecordAfterSave + + Draft + + + + varAgent + SObject + false + false + false + Agent__c + + + + + CalculatedCommission + Currency + IF(ISBLANK({!$Record.Sale_Price__c}), {!$Record.List_Price__c} * 0.03, {!$Record.Sale_Price__c} * 0.03) + + + + + Check_If_Sold + + 176 + 134 + + End_No_Action + + Not Sold + + Is_Newly_Sold + and + + $Record.Listing_Status__c + EqualTo + + Sold + + + + $Record__Prior.Listing_Status__c + NotEqualTo + + Sold + + + + Get_Agent + + + + + + + + Get_Agent + + 264 + 242 + false + + Create_Commission + + and + + Id + EqualTo + + $Record.Agent__c + + + Agent__c + varAgent + Id + Name + Commission_Rate__c + + + + + Create_Commission + + 264 + 350 + + Agent__c + + $Record.Agent__c + + + + Listing__c + + $Record.Id + + + + Commission_Amount__c + + CalculatedCommission + + + + Commission_Type__c + + Real Estate Sale + + + + Status__c + + Pending + + + Commission__c + true + + + + + End_No_Action + + 50 + 242 + + varAgent + Assign + + varAgent + + + + diff --git a/force-app/main/default/flows/Household_Create_Compliance_Log.flow-meta.xml b/force-app/main/default/flows/Household_Create_Compliance_Log.flow-meta.xml index de82341..50a05f3 100644 --- a/force-app/main/default/flows/Household_Create_Compliance_Log.flow-meta.xml +++ b/force-app/main/default/flows/Household_Create_Compliance_Log.flow-meta.xml @@ -66,5 +66,5 @@ Create RecordAfterSave - Draft + Active diff --git a/force-app/main/default/flows/Lead_to_Deal_Conversion.flow-meta.xml b/force-app/main/default/flows/Lead_to_Deal_Conversion.flow-meta.xml new file mode 100644 index 0000000..cbf0d0c --- /dev/null +++ b/force-app/main/default/flows/Lead_to_Deal_Conversion.flow-meta.xml @@ -0,0 +1,100 @@ + + + 59.0 + Converts a qualified lead to a deal in the General CRM + Lead to Deal Conversion {!$Flow.CurrentDateTime} + + + BuilderType + + LightningFlowBuilder + + + Flow + DefaultMode + + 50 + 0 + + Get_Lead_Record + + + Draft + + recordId + String + false + true + false + + + varLead + SObject + false + false + false + Lead__c + + + Get_Lead_Record + + 176 + 134 + false + + Enter_Deal_Details + + and + + Id + EqualTo + + recordId + + + Lead__c + varLead + Id + Name + + + Enter_Deal_Details + + 176 + 242 + false + true + false + + Create_Deal_Record + + + DealNameHeader + DisplayText + <p><b>Converting Lead: {!varLead.Name}</b></p> + + + DealName + String + Deal Name + InputField + true + + true + true + + + Create_Deal_Record + + 176 + 350 + + Name + + DealName + + + Deal__c + true + + diff --git a/force-app/main/default/flows/Liquidity_Event_Alert.flow-meta.xml b/force-app/main/default/flows/Liquidity_Event_Alert.flow-meta.xml index dce75dd..7325026 100644 --- a/force-app/main/default/flows/Liquidity_Event_Alert.flow-meta.xml +++ b/force-app/main/default/flows/Liquidity_Event_Alert.flow-meta.xml @@ -60,5 +60,5 @@ Create RecordAfterSave - Draft + Active diff --git a/force-app/main/default/flows/Mortality_Event_Workflow.flow-meta.xml b/force-app/main/default/flows/Mortality_Event_Workflow.flow-meta.xml index 49607eb..db4fda9 100644 --- a/force-app/main/default/flows/Mortality_Event_Workflow.flow-meta.xml +++ b/force-app/main/default/flows/Mortality_Event_Workflow.flow-meta.xml @@ -60,5 +60,5 @@ Create RecordAfterSave - Draft + Active diff --git a/force-app/main/default/flows/Policy_Renewal_Reminder.flow-meta.xml b/force-app/main/default/flows/Policy_Renewal_Reminder.flow-meta.xml new file mode 100644 index 0000000..1bb4641 --- /dev/null +++ b/force-app/main/default/flows/Policy_Renewal_Reminder.flow-meta.xml @@ -0,0 +1,166 @@ + + + 59.0 + Scheduled flow that identifies policies expiring within 30 days and creates reminder tasks for agents + Policy Renewal Reminder {!$Flow.CurrentDateTime} + + + BuilderType + + LightningFlowBuilder + + + AutoLaunchedFlow + DefaultMode + + 50 + 0 + + Get_Expiring_Policies + + + Daily + 2024-01-01 + 08:00:00.000Z + + Scheduled + + Draft + + + + varExpiringPolicies + SObject + true + false + false + Policy__c + + + + + varCurrentPolicy + SObject + false + false + false + Policy__c + + + + + ThirtyDaysFromNow + Date + {!$Flow.CurrentDate} + 30 + + + + + Get_Expiring_Policies + + 176 + 134 + false + + Loop_Through_Policies + + and + + Expiration_Date__c + LessThanOrEqualTo + + ThirtyDaysFromNow + + + + Expiration_Date__c + GreaterThanOrEqualTo + + $Flow.CurrentDate + + + + Status__c + EqualTo + + Active + + + Policy__c + varExpiringPolicies + Id + Name + Agent__c + Client__c + Expiration_Date__c + Premium__c + + + + + Loop_Through_Policies + + 176 + 242 + varExpiringPolicies + Asc + + Create_Renewal_Task + + + End_Flow + + + + + + Create_Renewal_Task + + 264 + 350 + + Loop_Through_Policies + + + Subject + + Policy Renewal Reminder: Review expiring policy + + + + Status + + Not Started + + + + Priority + + High + + + + OwnerId + + $User.Id + + + Task + true + + + + + End_Flow + + 50 + 350 + + varCurrentPolicy + Assign + + varCurrentPolicy + + + + diff --git a/force-app/main/default/permissionsets/BlackRoad_Hub_Admin.permissionset-meta.xml b/force-app/main/default/permissionsets/BlackRoad_Hub_Admin.permissionset-meta.xml index 549e5ba..d94acdd 100644 --- a/force-app/main/default/permissionsets/BlackRoad_Hub_Admin.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/BlackRoad_Hub_Admin.permissionset-meta.xml @@ -3,6 +3,166 @@ Full access to BlackRoad OS Hub false + + + true + Client_Household__c.Total_AUM__c + true + + + true + Client_Household__c.Annual_Fee__c + true + + + true + Client_Household__c.Household_Status__c + true + + + true + Client_Household__c.Risk_Tolerance__c + true + + + true + Client_Household__c.Last_Review_Date__c + true + + + true + Client_Household__c.Next_Review_Date__c + true + + + true + Client_Household__c.Primary_Contact__c + true + + + true + Client_Household__c.Secondary_Contact__c + true + + + + true + Financial_Account__c.Account_Type__c + true + + + true + Financial_Account__c.Current_Value__c + true + + + true + Financial_Account__c.Custodian__c + true + + + true + Financial_Account__c.Household__c + true + + + true + Financial_Account__c.Is_Liquid__c + true + + + + true + Liquidity_Event__c.Event_Type__c + true + + + true + Liquidity_Event__c.Gross_Proceeds__c + true + + + true + Liquidity_Event__c.Estimated_Tax__c + true + + + true + Liquidity_Event__c.Net_Proceeds__c + true + + + true + Liquidity_Event__c.QSBS_Eligible__c + true + + + true + Liquidity_Event__c.Status__c + true + + + true + Liquidity_Event__c.Household__c + true + + + + true + Mortality_Event__c.Date_of_Death__c + true + + + true + Mortality_Event__c.Death_Certificate_Received__c + true + + + true + Mortality_Event__c.Executor_Name__c + true + + + true + Mortality_Event__c.Total_Estate_Value__c + true + + + true + Mortality_Event__c.Probate_Required__c + true + + + true + Mortality_Event__c.Status__c + true + + + true + Mortality_Event__c.Household__c + true + + + + true + Compliance_Log__c.Log_Type__c + true + + + true + Compliance_Log__c.Description__c + true + + + true + Compliance_Log__c.Auto_Generated__c + true + + + true + Compliance_Log__c.Household__c + true + true true diff --git a/scripts/apex/loadAllSampleData.apex b/scripts/apex/loadAllSampleData.apex index 6e122ad..2fcaabb 100644 --- a/scripts/apex/loadAllSampleData.apex +++ b/scripts/apex/loadAllSampleData.apex @@ -4,12 +4,13 @@ // ============================================ // ----- FINANCIAL ADVISOR CRM ----- +// Note: Client_Household__c only has Name field in current deployment List households = new List(); -households.add(new Client_Household__c(Name='The Johnson Family', Household_Status__c='Active', Risk_Tolerance__c='Moderate', Total_AUM__c=1250000)); -households.add(new Client_Household__c(Name='The Martinez Family', Household_Status__c='Active', Risk_Tolerance__c='Aggressive', Total_AUM__c=3500000)); -households.add(new Client_Household__c(Name='The Thompson Trust', Household_Status__c='Active', Risk_Tolerance__c='Conservative', Total_AUM__c=8750000)); -households.add(new Client_Household__c(Name='The Williams Estate', Household_Status__c='Prospect', Risk_Tolerance__c='Moderate', Total_AUM__c=2100000)); -households.add(new Client_Household__c(Name='The Chen Family', Household_Status__c='Active', Risk_Tolerance__c='Aggressive', Total_AUM__c=5600000)); +households.add(new Client_Household__c(Name='Johnson Family - $1.25M AUM')); +households.add(new Client_Household__c(Name='Martinez Family - $3.5M AUM')); +households.add(new Client_Household__c(Name='Thompson Trust - $8.75M AUM')); +households.add(new Client_Household__c(Name='Williams Estate - $2.1M AUM')); +households.add(new Client_Household__c(Name='Park Family - $5.6M AUM')); insert households; System.debug('Created ' + households.size() + ' FA households'); diff --git a/scripts/apex/minimalDataLoader.apex b/scripts/apex/minimalDataLoader.apex new file mode 100644 index 0000000..f7d9b21 --- /dev/null +++ b/scripts/apex/minimalDataLoader.apex @@ -0,0 +1,22 @@ +// Minimal Data Loader - Only Name fields +System.debug('Starting minimal data load...'); + +// FA CRM +insert new Client_Household__c(Name='Johnson Family'); +insert new Client_Household__c(Name='Martinez Family'); +System.debug('Created 2 FA households'); + +// General CRM +insert new Company__c(Name='Acme Corporation'); +insert new Lead__c(Name='Sarah Wilson'); +insert new Deal__c(Name='Enterprise License'); +System.debug('Created General CRM records'); + +// Agency CRM +insert new Agent__c(Name='Robert Anderson'); +insert new Client__c(Name='John Smith'); +insert new Policy__c(Name='POL-2024-001'); +insert new Listing__c(Name='123 Oak Street'); +System.debug('Created Agency CRM records'); + +System.debug('=== MINIMAL DATA LOAD COMPLETE ==='); diff --git a/scripts/apex/simpleDataLoader.apex b/scripts/apex/simpleDataLoader.apex new file mode 100644 index 0000000..2cf647c --- /dev/null +++ b/scripts/apex/simpleDataLoader.apex @@ -0,0 +1,65 @@ +// ============================================ +// BLACKROAD HUB - SIMPLE DATA LOADER +// Creates minimal sample data for all 3 CRMs +// ============================================ + +// ----- FINANCIAL ADVISOR CRM ----- +List households = new List(); +households.add(new Client_Household__c(Name='Johnson Family - $1.25M AUM')); +households.add(new Client_Household__c(Name='Martinez Family - $3.5M AUM')); +households.add(new Client_Household__c(Name='Thompson Trust - $8.75M AUM')); +insert households; +System.debug('Created ' + households.size() + ' FA households'); + +// ----- GENERAL CRM ----- +List companies = new List(); +companies.add(new Company__c(Name='Acme Corporation')); +companies.add(new Company__c(Name='GlobalTech Solutions')); +companies.add(new Company__c(Name='Midwest Manufacturing')); +insert companies; +System.debug('Created ' + companies.size() + ' companies'); + +List leads = new List(); +leads.add(new Lead__c(Name='Sarah Wilson')); +leads.add(new Lead__c(Name='Michael Brown')); +leads.add(new Lead__c(Name='Jennifer Lee')); +insert leads; +System.debug('Created ' + leads.size() + ' leads'); + +List deals = new List(); +deals.add(new Deal__c(Name='Acme Enterprise License', Company__c=companies[0].Id)); +deals.add(new Deal__c(Name='GlobalTech Platform Upgrade', Company__c=companies[1].Id)); +deals.add(new Deal__c(Name='Midwest ERP Implementation', Company__c=companies[2].Id)); +insert deals; +System.debug('Created ' + deals.size() + ' deals'); + +// ----- AGENCY CRM ----- +List agents = new List(); +agents.add(new Agent__c(Name='Robert Anderson')); +agents.add(new Agent__c(Name='Lisa Chen')); +agents.add(new Agent__c(Name='James Wilson')); +insert agents; +System.debug('Created ' + agents.size() + ' agents'); + +List clients = new List(); +clients.add(new Client__c(Name='John Smith', Primary_Agent__c=agents[0].Id)); +clients.add(new Client__c(Name='Amanda Johnson', Primary_Agent__c=agents[1].Id)); +clients.add(new Client__c(Name='Thomas Davis', Primary_Agent__c=agents[2].Id)); +insert clients; +System.debug('Created ' + clients.size() + ' clients'); + +List policies = new List(); +policies.add(new Policy__c(Name='POL-2024-001', Client__c=clients[0].Id, Agent__c=agents[0].Id)); +policies.add(new Policy__c(Name='POL-2024-002', Client__c=clients[1].Id, Agent__c=agents[1].Id)); +policies.add(new Policy__c(Name='POL-2024-003', Client__c=clients[2].Id, Agent__c=agents[2].Id)); +insert policies; +System.debug('Created ' + policies.size() + ' policies'); + +List listings = new List(); +listings.add(new Listing__c(Name='123 Oak Street', Agent__c=agents[1].Id)); +listings.add(new Listing__c(Name='456 Pine Avenue', Agent__c=agents[1].Id)); +listings.add(new Listing__c(Name='789 Maple Drive', Agent__c=agents[0].Id)); +insert listings; +System.debug('Created ' + listings.size() + ' listings'); + +System.debug('=== SIMPLE DATA LOAD COMPLETE ==='); diff --git a/scripts/apex/testNewCRMs.apex b/scripts/apex/testNewCRMs.apex new file mode 100644 index 0000000..8dd2a29 --- /dev/null +++ b/scripts/apex/testNewCRMs.apex @@ -0,0 +1,38 @@ +// Test New CRMs Only (skip FA CRM with flow issues) +System.debug('Testing General CRM and Agency CRM...'); + +// General CRM +Company__c comp = new Company__c(Name='Acme Corporation'); +insert comp; +System.debug('Created Company: ' + comp.Id); + +Lead__c lead = new Lead__c(Name='Sarah Wilson'); +insert lead; +System.debug('Created Lead: ' + lead.Id); + +Deal__c deal = new Deal__c(Name='Enterprise License'); +insert deal; +System.debug('Created Deal: ' + deal.Id); + +// Agency CRM +Agent__c agent = new Agent__c(Name='Robert Anderson'); +insert agent; +System.debug('Created Agent: ' + agent.Id); + +Client__c client = new Client__c(Name='John Smith'); +insert client; +System.debug('Created Client: ' + client.Id); + +Policy__c policy = new Policy__c(Name='POL-2024-001'); +insert policy; +System.debug('Created Policy: ' + policy.Id); + +Listing__c listing = new Listing__c(Name='123 Oak Street'); +insert listing; +System.debug('Created Listing: ' + listing.Id); + +Commission__c comm = new Commission__c(); +insert comm; +System.debug('Created Commission: ' + comm.Id); + +System.debug('=== NEW CRM TEST COMPLETE ===');