Skip to content

Commit c7a6750

Browse files
authored
Merge pull request #1096 from objectstack-ai/copilot/fix-initial-data-order-product
2 parents 94f85c7 + 370c8c1 commit c7a6750

File tree

9 files changed

+64
-60
lines changed

9 files changed

+64
-60
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- **CRM Seed Data Lookup References** (`examples/crm`): Fixed all CRM seed data files to use natural key (`name`) references for lookup fields instead of raw `id` values. The `SeedLoaderService` resolves foreign key references by the target object's `name` field (the default `externalId`), so seed data values like `order: "o1"` or `account: "2"` could not be resolved and were set to `null`. Updated all 8 affected data files (`account`, `contact`, `opportunity`, `order`, `order_item`, `opportunity_contact`, `project_task`, `event`) to use human-readable name references (e.g., `order: "ORD-2024-001"`, `product: "Workstation Pro Laptop"`, `account: "Salesforce Tower"`). This fixes the issue where Order and Product columns displayed as empty in the Order Item grid view.
13+
1014
### Added
1115

1216
- **Lookup Field Selection Display Fix** (`@object-ui/fields`): Fixed a bug where selecting a record from the RecordPickerDialog (Level 2 popup) produced no visible feedback in the LookupField. The root cause: `findOption` only searched static and popover-fetched options, which did not include records loaded by the dialog. Added `onSelectRecords` callback to `RecordPickerDialogProps` that returns full record objects alongside IDs. LookupField now caches selected records from the dialog and displays their labels/badges correctly. Both single-select and multi-select modes are supported. Includes a `selectedRecordsMap` ref in RecordPickerDialog that persists selected record data across page navigation for multi-select scenarios.

examples/crm/src/data/account.data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const AccountData = {
1818
tags: ['enterprise', 'strategic'],
1919
rating: "hot",
2020
founded_date: new Date("2020-06-01"),
21-
owner: "1",
21+
owner: "Martin CEO",
2222
created_at: new Date("2023-01-15")
2323
},
2424
{
@@ -36,7 +36,7 @@ export const AccountData = {
3636
tags: ['enterprise'],
3737
rating: "hot",
3838
annual_revenue: 26000000,
39-
owner: "1",
39+
owner: "Martin CEO",
4040
created_at: new Date("2023-02-20")
4141
},
4242
{
@@ -53,7 +53,7 @@ export const AccountData = {
5353
tags: ['enterprise'],
5454
rating: "warm",
5555
annual_revenue: 8500000,
56-
owner: "2",
56+
owner: "Sarah Sales",
5757
created_at: new Date("2023-03-10")
5858
},
5959
{
@@ -69,7 +69,7 @@ export const AccountData = {
6969
phone: "+44-555-0104",
7070
tags: ['smb'],
7171
rating: "warm",
72-
owner: "2",
72+
owner: "Sarah Sales",
7373
created_at: new Date("2023-04-05")
7474
},
7575
{
@@ -85,7 +85,7 @@ export const AccountData = {
8585
phone: "+81-555-0105",
8686
tags: ['startup'],
8787
rating: "cold",
88-
owner: "1",
88+
owner: "Martin CEO",
8989
created_at: new Date("2023-05-20")
9090
},
9191
{
@@ -103,7 +103,7 @@ export const AccountData = {
103103
tags: ['enterprise', 'strategic'],
104104
rating: "hot",
105105
annual_revenue: 42000000,
106-
owner: "1",
106+
owner: "Martin CEO",
107107
created_at: new Date("2023-06-15")
108108
},
109109
{
@@ -120,7 +120,7 @@ export const AccountData = {
120120
tags: ['smb'],
121121
rating: "warm",
122122
annual_revenue: 3200000,
123-
owner: "2",
123+
owner: "Sarah Sales",
124124
created_at: new Date("2023-07-01")
125125
}
126126
]

examples/crm/src/data/contact.data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const ContactData = {
99
phone: "415-555-1001",
1010
title: "VP Sales",
1111
department: "Sales",
12-
account: "1",
12+
account: "ObjectStack HQ",
1313
status: "active",
1414
priority: "high",
1515
lead_source: "Partner",
@@ -26,7 +26,7 @@ export const ContactData = {
2626
phone: "415-555-1002",
2727
title: "CTO",
2828
department: "Engineering",
29-
account: "2",
29+
account: "Salesforce Tower",
3030
status: "active",
3131
priority: "high",
3232
lead_source: "Referral",
@@ -43,7 +43,7 @@ export const ContactData = {
4343
phone: "212-555-1003",
4444
title: "Procurement Manager",
4545
department: "Purchasing",
46-
account: "3",
46+
account: "Global Financial Services",
4747
status: "customer",
4848
priority: "medium",
4949
lead_source: "Web",
@@ -59,7 +59,7 @@ export const ContactData = {
5959
phone: "+44-555-1004",
6060
title: "Director",
6161
department: "Management",
62-
account: "4",
62+
account: "London Consulting Grp",
6363
status: "active",
6464
priority: "high",
6565
lead_source: "Referral",
@@ -76,7 +76,7 @@ export const ContactData = {
7676
phone: "+49-555-1005",
7777
title: "Head of Operations",
7878
department: "Operations",
79-
account: "6",
79+
account: "Berlin AutoWorks",
8080
status: "lead",
8181
priority: "high",
8282
lead_source: "Web",
@@ -92,7 +92,7 @@ export const ContactData = {
9292
phone: "+33-555-1006",
9393
title: "Creative Director",
9494
department: "Design",
95-
account: "7",
95+
account: "Paris Fashion House",
9696
status: "customer",
9797
priority: "low",
9898
lead_source: "Trade Show",
@@ -108,7 +108,7 @@ export const ContactData = {
108108
phone: "415-555-1007",
109109
title: "Senior Developer",
110110
department: "Engineering",
111-
account: "2",
111+
account: "Salesforce Tower",
112112
status: "active",
113113
priority: "low",
114114
lead_source: "Phone",

examples/crm/src/data/event.data.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ export const EventData = {
22
object: 'event',
33
mode: 'upsert' as const,
44
records: [
5-
{ id: "e1", subject: "Weekly Standup", start: new Date("2024-02-05T09:00:00"), end: new Date("2024-02-05T10:00:00"), location: "Conference Room A", type: "meeting", status: "completed", organizer: "1", reminder: "min_15", description: "Team synchronization regarding Project Alpha", participants: ["1", "2", "5"] },
6-
{ id: "e2", subject: "Client Call - TechCorp", start: new Date("2024-02-06T14:00:00"), end: new Date("2024-02-06T15:00:00"), location: "Zoom", type: "call", status: "completed", organizer: "2", reminder: "min_5", description: "Reviewing Q1 Goals and Roadblocks", participants: ["2", "7"] },
7-
{ id: "e3", subject: "Project Review", start: new Date("2024-02-08T10:00:00"), end: new Date("2024-02-08T11:30:00"), location: "Board Room", type: "meeting", status: "completed", organizer: "1", reminder: "min_30", description: "Milestone review with stakeholders", participants: ["1", "3", "4"] },
8-
{ id: "e4", subject: "Lunch with Partners", start: new Date("2024-02-09T12:00:00"), end: new Date("2024-02-09T13:30:00"), location: "Downtown Cafe", type: "other", status: "completed", organizer: "2", description: "Networking event", participants: ["4", "6"] },
9-
{ id: "e5", subject: "Product Demo - Berlin Auto", start: new Date("2024-03-10T11:00:00"), end: new Date("2024-03-10T12:30:00"), location: "Online", type: "meeting", status: "scheduled", organizer: "1", reminder: "hour_1", is_private: false, description: "Showcasing the new automation suite capabilities", participants: ["5"] },
10-
{ id: "e6", subject: "Internal Training", start: new Date("2024-03-15T09:00:00"), end: new Date("2024-03-15T16:00:00"), location: "Training Center", type: "other", status: "scheduled", organizer: "1", is_all_day: true, reminder: "day_1", description: "Security compliance training for all staff", participants: ["1", "2", "3", "5", "6", "7"] },
5+
{ id: "e1", subject: "Weekly Standup", start: new Date("2024-02-05T09:00:00"), end: new Date("2024-02-05T10:00:00"), location: "Conference Room A", type: "meeting", status: "completed", organizer: "Martin CEO", reminder: "min_15", description: "Team synchronization regarding Project Alpha", participants: ["1", "2", "5"] },
6+
{ id: "e2", subject: "Client Call - TechCorp", start: new Date("2024-02-06T14:00:00"), end: new Date("2024-02-06T15:00:00"), location: "Zoom", type: "call", status: "completed", organizer: "Sarah Sales", reminder: "min_5", description: "Reviewing Q1 Goals and Roadblocks", participants: ["2", "7"] },
7+
{ id: "e3", subject: "Project Review", start: new Date("2024-02-08T10:00:00"), end: new Date("2024-02-08T11:30:00"), location: "Board Room", type: "meeting", status: "completed", organizer: "Martin CEO", reminder: "min_30", description: "Milestone review with stakeholders", participants: ["1", "3", "4"] },
8+
{ id: "e4", subject: "Lunch with Partners", start: new Date("2024-02-09T12:00:00"), end: new Date("2024-02-09T13:30:00"), location: "Downtown Cafe", type: "other", status: "completed", organizer: "Sarah Sales", description: "Networking event", participants: ["4", "6"] },
9+
{ id: "e5", subject: "Product Demo - Berlin Auto", start: new Date("2024-03-10T11:00:00"), end: new Date("2024-03-10T12:30:00"), location: "Online", type: "meeting", status: "scheduled", organizer: "Martin CEO", reminder: "hour_1", is_private: false, description: "Showcasing the new automation suite capabilities", participants: ["5"] },
10+
{ id: "e6", subject: "Internal Training", start: new Date("2024-03-15T09:00:00"), end: new Date("2024-03-15T16:00:00"), location: "Training Center", type: "other", status: "scheduled", organizer: "Martin CEO", is_all_day: true, reminder: "day_1", description: "Security compliance training for all staff", participants: ["1", "2", "3", "5", "6", "7"] },
1111
]
1212
};

examples/crm/src/data/opportunity.data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const OpportunityData = {
1010
stage: "closed_won",
1111
forecast_category: "commit",
1212
close_date: new Date("2024-01-15"),
13-
account: "2",
13+
account: "Salesforce Tower",
1414
contacts: ["2", "7"],
1515
probability: 100,
1616
type: "New Business",
@@ -26,7 +26,7 @@ export const OpportunityData = {
2626
stage: "negotiation",
2727
forecast_category: "best_case",
2828
close_date: new Date("2024-03-30"),
29-
account: "3",
29+
account: "Global Financial Services",
3030
contacts: ["3"],
3131
probability: 80,
3232
type: "Upgrade",
@@ -42,7 +42,7 @@ export const OpportunityData = {
4242
stage: "proposal",
4343
forecast_category: "pipeline",
4444
close_date: new Date("2024-05-15"),
45-
account: "4",
45+
account: "London Consulting Grp",
4646
contacts: ["4"],
4747
probability: 60,
4848
type: "Renewal",
@@ -58,7 +58,7 @@ export const OpportunityData = {
5858
stage: "prospecting",
5959
forecast_category: "pipeline",
6060
close_date: new Date("2024-09-01"),
61-
account: "6",
61+
account: "Berlin AutoWorks",
6262
contacts: ["5"],
6363
probability: 20,
6464
type: "New Business",
@@ -75,7 +75,7 @@ export const OpportunityData = {
7575
stage: "qualification",
7676
forecast_category: "pipeline",
7777
close_date: new Date("2024-07-20"),
78-
account: "7",
78+
account: "Paris Fashion House",
7979
contacts: ["6"],
8080
probability: 40,
8181
type: "New Business",
@@ -91,7 +91,7 @@ export const OpportunityData = {
9191
stage: "closed_lost",
9292
forecast_category: "omitted",
9393
close_date: new Date("2024-02-10"),
94-
account: "5",
94+
account: "Tokyo E-Commerce",
9595
contacts: [],
9696
probability: 0,
9797
type: "New Business",
@@ -107,7 +107,7 @@ export const OpportunityData = {
107107
stage: "closed_won",
108108
forecast_category: "commit",
109109
close_date: new Date("2024-02-28"),
110-
account: "2",
110+
account: "Salesforce Tower",
111111
contacts: ["2"],
112112
probability: 100,
113113
type: "Upgrade",

examples/crm/src/data/opportunity_contact.data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ export const OpportunityContactData = {
22
object: 'opportunity_contact',
33
mode: 'upsert' as const,
44
records: [
5-
{ id: "oc1", name: 'Bob Smith — Enterprise License', opportunity: "101", contact: "2", role: 'decision_maker', is_primary: true },
6-
{ id: "oc2", name: 'George Martin — Enterprise License', opportunity: "101", contact: "7", role: 'evaluator', is_primary: false },
7-
{ id: "oc3", name: 'Charlie Brown — Global Fin Q1', opportunity: "102", contact: "3", role: 'champion', is_primary: true },
8-
{ id: "oc4", name: 'Diana Prince — London Renewal', opportunity: "103", contact: "4", role: 'decision_maker', is_primary: true },
9-
{ id: "oc5", name: 'Evan Wright — Berlin Automation', opportunity: "104", contact: "5", role: 'influencer', is_primary: true },
10-
{ id: "oc6", name: 'Fiona Gallagher — Paris POS', opportunity: "105", contact: "6", role: 'end_user', is_primary: true },
11-
{ id: "oc7", name: 'Bob Smith — SF Tower', opportunity: "107", contact: "2", role: 'decision_maker', is_primary: true },
5+
{ id: "oc1", name: 'Bob Smith — Enterprise License', opportunity: "ObjectStack Enterprise License", contact: "Bob Smith", role: 'decision_maker', is_primary: true },
6+
{ id: "oc2", name: 'George Martin — Enterprise License', opportunity: "ObjectStack Enterprise License", contact: "George Martin", role: 'evaluator', is_primary: false },
7+
{ id: "oc3", name: 'Charlie Brown — Global Fin Q1', opportunity: "Global Fin Q1 Upsell", contact: "Charlie Brown", role: 'champion', is_primary: true },
8+
{ id: "oc4", name: 'Diana Prince — London Renewal', opportunity: "London Annual Renewal", contact: "Diana Prince", role: 'decision_maker', is_primary: true },
9+
{ id: "oc5", name: 'Evan Wright — Berlin Automation', opportunity: "Berlin Automation Project", contact: "Evan Wright", role: 'influencer', is_primary: true },
10+
{ id: "oc6", name: 'Fiona Gallagher — Paris POS', opportunity: "Paris Store POS System", contact: "Fiona Gallagher", role: 'end_user', is_primary: true },
11+
{ id: "oc7", name: 'Bob Smith — SF Tower', opportunity: "SF Tower Expansion", contact: "Bob Smith", role: 'decision_maker', is_primary: true },
1212
]
1313
};

examples/crm/src/data/order.data.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ export const OrderData = {
22
object: 'order',
33
mode: 'upsert' as const,
44
records: [
5-
{ id: "o1", name: 'ORD-2024-001', customer: "2", account: "2", order_date: new Date('2024-01-15'), amount: 15459.99, status: 'paid', payment_method: 'Wire Transfer', shipping_address: '415 Mission St, San Francisco, CA 94105', tracking_number: '1Z999AA10123456784' },
6-
{ id: "o2", name: 'ORD-2024-002', customer: "3", account: "3", order_date: new Date('2024-01-18'), amount: 289.50, status: 'pending', payment_method: 'Credit Card', discount: 5 },
7-
{ id: "o3", name: 'ORD-2024-003', customer: "4", account: "4", order_date: new Date('2024-02-05'), amount: 5549.99, status: 'shipped', payment_method: 'Wire Transfer', shipping_address: '10 Downing St, London, UK', tracking_number: 'GB999AA20234567890' },
8-
{ id: "o4", name: 'ORD-2024-004', customer: "5", account: "6", order_date: new Date('2024-02-20'), amount: 42500.00, status: 'delivered', payment_method: 'Invoice', shipping_address: 'Industriepark 12, Berlin, Germany', discount: 10 },
9-
{ id: "o5", name: 'ORD-2024-005', customer: "1", account: "1", order_date: new Date('2024-03-01'), amount: 1250.00, status: 'draft', payment_method: 'PayPal' },
10-
{ id: "o6", name: 'ORD-2024-006', customer: "6", account: "7", order_date: new Date('2024-03-10'), amount: 899.99, status: 'cancelled', payment_method: 'Credit Card', notes: 'Customer requested cancellation before shipment' },
11-
{ id: "o7", name: 'ORD-2024-007', customer: "7", account: "2", order_date: new Date('2024-03-15'), amount: 8999.94, status: 'paid', payment_method: 'Check', shipping_address: '415 Mission St, San Francisco, CA 94105' },
5+
{ id: "o1", name: 'ORD-2024-001', customer: "Bob Smith", account: "Salesforce Tower", order_date: new Date('2024-01-15'), amount: 15459.99, status: 'paid', payment_method: 'Wire Transfer', shipping_address: '415 Mission St, San Francisco, CA 94105', tracking_number: '1Z999AA10123456784' },
6+
{ id: "o2", name: 'ORD-2024-002', customer: "Charlie Brown", account: "Global Financial Services", order_date: new Date('2024-01-18'), amount: 289.50, status: 'pending', payment_method: 'Credit Card', discount: 5 },
7+
{ id: "o3", name: 'ORD-2024-003', customer: "Diana Prince", account: "London Consulting Grp", order_date: new Date('2024-02-05'), amount: 5549.99, status: 'shipped', payment_method: 'Wire Transfer', shipping_address: '10 Downing St, London, UK', tracking_number: 'GB999AA20234567890' },
8+
{ id: "o4", name: 'ORD-2024-004', customer: "Evan Wright", account: "Berlin AutoWorks", order_date: new Date('2024-02-20'), amount: 42500.00, status: 'delivered', payment_method: 'Invoice', shipping_address: 'Industriepark 12, Berlin, Germany', discount: 10 },
9+
{ id: "o5", name: 'ORD-2024-005', customer: "Alice Johnson", account: "ObjectStack HQ", order_date: new Date('2024-03-01'), amount: 1250.00, status: 'draft', payment_method: 'PayPal' },
10+
{ id: "o6", name: 'ORD-2024-006', customer: "Fiona Gallagher", account: "Paris Fashion House", order_date: new Date('2024-03-10'), amount: 899.99, status: 'cancelled', payment_method: 'Credit Card', notes: 'Customer requested cancellation before shipment' },
11+
{ id: "o7", name: 'ORD-2024-007', customer: "George Martin", account: "Salesforce Tower", order_date: new Date('2024-03-15'), amount: 8999.94, status: 'paid', payment_method: 'Check', shipping_address: '415 Mission St, San Francisco, CA 94105' },
1212
]
1313
};

0 commit comments

Comments
 (0)