Skip to content

Commit 6ed8d77

Browse files
hotlongCopilot
andcommitted
fix(crm-example): use supported analytics fields on executive dashboard
The executive dashboard had two widgets configured with fields the analytics service can't resolve, producing 500 errors: - 'Revenue by Industry' grouped opportunity by 'account.industry' (cross-relation traversal not supported by the SQL strategy). - 'New Accounts' grouped account by 'created_date', but account only has the standard 'created_at' audit field. Switched the first widget to group opportunity by 'lead_source' (a real opportunity select field) and renamed it 'Revenue by Lead Source' with matching translations in en/zh/ja/es. Switched the second widget to 'created_at'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 25f169d commit 6ed8d77

6 files changed

Lines changed: 53 additions & 48 deletions

File tree

examples/app-crm/dist/objectstack.json

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,9 +1140,9 @@
11401140
"title": "Revenue Trend",
11411141
"description": "Closed-won revenue over the last 12 months"
11421142
},
1143-
"revenue_by_industry": {
1144-
"title": "Revenue by Industry",
1145-
"description": "YTD closed-won revenue split by account industry"
1143+
"revenue_by_lead_source": {
1144+
"title": "Revenue by Lead Source",
1145+
"description": "YTD closed-won revenue split by originating lead source"
11461146
},
11471147
"pipeline_by_stage": {
11481148
"title": "Pipeline by Stage",
@@ -2499,9 +2499,9 @@
24992499
"title": "收入趋势",
25002500
"description": "过去 12 个月的已成交收入"
25012501
},
2502-
"revenue_by_industry": {
2503-
"title": "行业收入分布",
2504-
"description": "本年度已成交收入按客户行业拆分"
2502+
"revenue_by_lead_source": {
2503+
"title": "线索来源收入分布",
2504+
"description": "本年度已成交收入按线索来源拆分"
25052505
},
25062506
"pipeline_by_stage": {
25072507
"title": "阶段管道分布",
@@ -3758,9 +3758,9 @@
37583758
"title": "売上トレンド",
37593759
"description": "過去12か月の成立済み売上"
37603760
},
3761-
"revenue_by_industry": {
3761+
"revenue_by_lead_source": {
37623762
"title": "業種別売上",
3763-
"description": "本年度の成立済み売上を取引先業種で分類"
3763+
"description": "本年度の成立済み売上をリードソース別に分類"
37643764
},
37653765
"pipeline_by_stage": {
37663766
"title": "フェーズ別パイプライン",
@@ -5017,9 +5017,9 @@
50175017
"title": "Tendencia de ingresos",
50185018
"description": "Ingresos cerrados ganados de los últimos 12 meses"
50195019
},
5020-
"revenue_by_industry": {
5021-
"title": "Ingresos por industria",
5022-
"description": "Ingresos YTD ganados separados por industria de la cuenta"
5020+
"revenue_by_lead_source": {
5021+
"title": "Ingresos por origen de lead",
5022+
"description": "Ingresos YTD ganados separados por origen del lead"
50235023
},
50245024
"pipeline_by_stage": {
50255025
"title": "Pipeline por etapa",
@@ -15438,9 +15438,9 @@
1543815438
}
1543915439
},
1544015440
{
15441-
"id": "revenue_by_industry",
15442-
"title": "Revenue by Industry",
15443-
"description": "YTD closed-won revenue split by account industry",
15441+
"id": "revenue_by_lead_source",
15442+
"title": "Revenue by Lead Source",
15443+
"description": "YTD closed-won revenue split by originating lead source",
1544415444
"type": "donut",
1544515445
"chartConfig": {
1544615446
"type": "donut",
@@ -15463,7 +15463,7 @@
1546315463
"$gte": "{current_year_start}"
1546415464
}
1546515465
},
15466-
"categoryField": "account.industry",
15466+
"categoryField": "lead_source",
1546715467
"valueField": "amount",
1546815468
"aggregate": "sum",
1546915469
"layout": {
@@ -15518,7 +15518,7 @@
1551815518
"chartConfig": {
1551915519
"type": "bar",
1552015520
"xAxis": {
15521-
"field": "created_date",
15521+
"field": "created_at",
1552215522
"title": "Month",
1552315523
"showGridLines": false,
1552415524
"logarithmic": false
@@ -15540,11 +15540,11 @@
1554015540
"colorVariant": "purple",
1554115541
"object": "account",
1554215542
"filter": {
15543-
"created_date": {
15543+
"created_at": {
1554415544
"$gte": "{last_6_months}"
1554515545
}
1554615546
},
15547-
"categoryField": "created_date",
15547+
"categoryField": "created_at",
1554815548
"aggregate": "count",
1554915549
"layout": {
1555015550
"x": 6,
@@ -15623,29 +15623,33 @@
1562315623
"scope": "dashboard"
1562415624
},
1562515625
{
15626-
"field": "account.industry",
15627-
"label": "Industry",
15626+
"field": "lead_source",
15627+
"label": "Lead Source",
1562815628
"type": "select",
1562915629
"options": [
1563015630
{
15631-
"value": "technology",
15632-
"label": "Technology"
15631+
"value": "web",
15632+
"label": "Web"
1563315633
},
1563415634
{
15635-
"value": "finance",
15636-
"label": "Finance"
15635+
"value": "referral",
15636+
"label": "Referral"
15637+
},
15638+
{
15639+
"value": "partner",
15640+
"label": "Partner"
1563715641
},
1563815642
{
15639-
"value": "healthcare",
15640-
"label": "Healthcare"
15643+
"value": "event",
15644+
"label": "Event"
1564115645
},
1564215646
{
15643-
"value": "retail",
15644-
"label": "Retail"
15647+
"value": "cold_call",
15648+
"label": "Cold Call"
1564515649
},
1564615650
{
15647-
"value": "manufacturing",
15648-
"label": "Manufacturing"
15651+
"value": "advertising",
15652+
"label": "Advertising"
1564915653
}
1565015654
],
1565115655
"scope": "dashboard"

examples/app-crm/src/dashboards/executive.dashboard.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,17 @@ export const ExecutiveDashboard: Dashboard = {
4545
optionsFrom: { object: 'user', valueField: 'id', labelField: 'name' },
4646
},
4747
{
48-
field: 'account.industry',
49-
label: 'Industry',
48+
field: 'lead_source',
49+
label: 'Lead Source',
5050
type: 'select',
5151
scope: 'dashboard',
5252
options: [
53-
{ value: 'technology', label: 'Technology' },
54-
{ value: 'finance', label: 'Finance' },
55-
{ value: 'healthcare', label: 'Healthcare' },
56-
{ value: 'retail', label: 'Retail' },
57-
{ value: 'manufacturing', label: 'Manufacturing' },
53+
{ value: 'web', label: 'Web' },
54+
{ value: 'referral', label: 'Referral' },
55+
{ value: 'partner', label: 'Partner' },
56+
{ value: 'event', label: 'Event' },
57+
{ value: 'cold_call', label: 'Cold Call' },
58+
{ value: 'advertising', label: 'Advertising' },
5859
],
5960
},
6061
],
@@ -166,13 +167,13 @@ export const ExecutiveDashboard: Dashboard = {
166167
options: { dateGranularity: 'month' },
167168
},
168169
{
169-
id: 'revenue_by_industry',
170-
title: 'Revenue by Industry',
171-
description: 'YTD closed-won revenue split by account industry',
170+
id: 'revenue_by_lead_source',
171+
title: 'Revenue by Lead Source',
172+
description: 'YTD closed-won revenue split by originating lead source',
172173
type: 'donut',
173174
object: 'opportunity',
174175
filter: { stage: 'closed_won', close_date: { $gte: '{current_year_start}' } },
175-
categoryField: 'account.industry',
176+
categoryField: 'lead_source',
176177
valueField: 'amount',
177178
aggregate: 'sum',
178179
colorVariant: 'blue',
@@ -211,8 +212,8 @@ export const ExecutiveDashboard: Dashboard = {
211212
description: 'Account creation cadence — last 6 months',
212213
type: 'bar',
213214
object: 'account',
214-
filter: { created_date: { $gte: '{last_6_months}' } },
215-
categoryField: 'created_date',
215+
filter: { created_at: { $gte: '{last_6_months}' } },
216+
categoryField: 'created_at',
216217
aggregate: 'count',
217218
colorVariant: 'purple',
218219
layout: { x: 6, y: 6, w: 6, h: 4 },
@@ -221,7 +222,7 @@ export const ExecutiveDashboard: Dashboard = {
221222
showLegend: false,
222223
showDataLabels: true,
223224
colors: ['#8B5CF6'],
224-
xAxis: { field: 'created_date', title: 'Month', showGridLines: false, logarithmic: false },
225+
xAxis: { field: 'created_at', title: 'Month', showGridLines: false, logarithmic: false },
225226
yAxis: [{ field: 'count', title: 'New accounts', showGridLines: true, logarithmic: false }],
226227
},
227228
options: { dateGranularity: 'month' },

examples/app-crm/src/translations/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ export const en: TranslationData = {
545545
total_contacts: { title: 'Total Contacts', description: 'People in our address book' },
546546
open_leads: { title: 'Open Leads', description: 'Unconverted leads in the funnel' },
547547
revenue_trend: { title: 'Revenue Trend', description: 'Closed-won revenue over the last 12 months' },
548-
revenue_by_industry: { title: 'Revenue by Industry', description: 'YTD closed-won revenue split by account industry' },
548+
revenue_by_lead_source: { title: 'Revenue by Lead Source', description: 'YTD closed-won revenue split by originating lead source' },
549549
pipeline_by_stage: { title: 'Pipeline by Stage', description: 'Open opportunity value by sales stage' },
550550
new_accounts_by_month: { title: 'New Accounts', description: 'Account creation cadence — last 6 months' },
551551
top_accounts_by_revenue: { title: 'Top Accounts by Revenue', description: 'Largest customers ranked by annual revenue' },

examples/app-crm/src/translations/es-ES.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export const esES: TranslationData = {
544544
total_contacts: { title: 'Total de contactos', description: 'Personas en nuestra agenda' },
545545
open_leads: { title: 'Prospectos abiertos', description: 'Prospectos sin convertir en el embudo' },
546546
revenue_trend: { title: 'Tendencia de ingresos', description: 'Ingresos cerrados ganados de los últimos 12 meses' },
547-
revenue_by_industry: { title: 'Ingresos por industria', description: 'Ingresos YTD ganados separados por industria de la cuenta' },
547+
revenue_by_lead_source: { title: 'Ingresos por origen de lead', description: 'Ingresos YTD ganados separados por origen del lead' },
548548
pipeline_by_stage: { title: 'Pipeline por etapa', description: 'Valor de oportunidades abiertas por etapa de venta' },
549549
new_accounts_by_month: { title: 'Cuentas nuevas', description: 'Ritmo de creación de cuentas en los últimos 6 meses' },
550550
top_accounts_by_revenue: { title: 'Cuentas principales por ingresos', description: 'Mayores clientes ordenados por ingreso anual' },

examples/app-crm/src/translations/ja-JP.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ export const jaJP: TranslationData = {
544544
total_contacts: { title: '取引先責任者数', description: '名簿に登録された取引先責任者' },
545545
open_leads: { title: 'オープンリード', description: '未取引開始のリード' },
546546
revenue_trend: { title: '売上トレンド', description: '過去12か月の成立済み売上' },
547-
revenue_by_industry: { title: '業種別売上', description: '本年度の成立済み売上を取引先業種で分類' },
547+
revenue_by_lead_source: { title: '業種別売上', description: '本年度の成立済み売上をリードソース別に分類' },
548548
pipeline_by_stage: { title: 'フェーズ別パイプライン', description: '営業フェーズ別のオープン商談金額' },
549549
new_accounts_by_month: { title: '新規取引先', description: '過去6か月の取引先作成ペース' },
550550
top_accounts_by_revenue: { title: '売上上位取引先', description: '年商で順位付けした主要顧客' },

examples/app-crm/src/translations/zh-CN.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ export const zhCN: TranslationData = {
617617
total_contacts: { title: '联系人总数', description: '通讯录中的联系人' },
618618
open_leads: { title: '未转化线索', description: '漏斗中尚未转化的线索' },
619619
revenue_trend: { title: '收入趋势', description: '过去 12 个月的已成交收入' },
620-
revenue_by_industry: { title: '行业收入分布', description: '本年度已成交收入按客户行业拆分' },
620+
revenue_by_lead_source: { title: '线索来源收入分布', description: '本年度已成交收入按线索来源拆分' },
621621
pipeline_by_stage: { title: '阶段管道分布', description: '按销售阶段统计的进行中商机金额' },
622622
new_accounts_by_month: { title: '新增客户', description: '过去 6 个月的客户创建节奏' },
623623
top_accounts_by_revenue: { title: '收入排名 Top 客户', description: '按年营收排序的最大客户' },

0 commit comments

Comments
 (0)