-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcrm-mappings.ts
More file actions
75 lines (72 loc) · 2.25 KB
/
Copy pathcrm-mappings.ts
File metadata and controls
75 lines (72 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
import { defineMapping } from '@objectstack/spec/data';
/**
* CSV import mapping for bulk lead upload.
* Maps common CRM export column names to crm_lead fields.
*/
export const LeadCsvImportMapping = defineMapping({
name: 'csv_import_leads',
label: 'CSV Import: Leads',
sourceFormat: 'csv',
targetObject: 'crm_lead',
mode: 'upsert',
upsertKey: ['email'],
fieldMapping: [
{ source: 'First Name', target: 'first_name', transform: 'none' },
{ source: 'Last Name', target: 'last_name', transform: 'none' },
{ source: 'Email', target: 'email', transform: 'none' },
{ source: 'Phone', target: 'phone', transform: 'none' },
{ source: 'Company', target: 'company', transform: 'none' },
{
source: 'Lead Status',
target: 'status',
transform: 'map',
params: {
valueMap: {
New: 'new',
'Working': 'contacted',
Qualified: 'qualified',
'Unqualified': 'disqualified',
Converted: 'converted',
},
},
},
{
source: 'Lead Source',
target: 'source',
transform: 'map',
params: {
valueMap: {
'Web': 'web',
'Email Campaign': 'email_campaign',
'Cold Call': 'cold_call',
'Referral': 'referral',
'Trade Show': 'trade_show',
},
},
},
{ source: 'Lead Score', target: 'lead_score', transform: 'none' },
],
errorPolicy: 'skip',
batchSize: 500,
});
/**
* JSON import mapping for contact sync from external systems (HubSpot, etc.).
*/
export const ContactJsonSyncMapping = defineMapping({
name: 'json_sync_contacts',
label: 'JSON Sync: Contacts from HubSpot',
sourceFormat: 'json',
targetObject: 'crm_contact',
mode: 'upsert',
upsertKey: ['email'],
fieldMapping: [
{ source: 'properties.firstname', target: 'first_name', transform: 'none' },
{ source: 'properties.lastname', target: 'last_name', transform: 'none' },
{ source: 'properties.email', target: 'email', transform: 'none' },
{ source: 'properties.phone', target: 'phone', transform: 'none' },
{ source: 'properties.jobtitle', target: 'title', transform: 'none' },
],
errorPolicy: 'skip',
batchSize: 250,
});