@salesforce/afv-skills 1.69.0 → 1.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/data360-code-extension-generate/SKILL.md +160 -252
- package/skills/data360-code-extension-generate/references/README.md +34 -172
- package/skills/data360-code-extension-generate/references/environment-setup.md +198 -0
- package/skills/data360-code-extension-generate/references/mcp-integration.md +36 -0
- package/skills/data360-code-extension-generate/references/quick-reference.md +132 -202
- package/skills/data360-code-extension-generate/references/run-logs.md +31 -0
- package/skills/data360-code-extension-generate/references/schema-discovery.md +45 -0
- package/skills/data360-code-extension-generate/references/troubleshooting.md +45 -0
- package/skills/data360-code-extension-generate/scripts/check_env.sh +197 -0
- package/skills/data360-code-extension-generate/scripts/venv_hook.sh +22 -0
- package/skills/dx-devops-work-item-manage/SKILL.md +24 -8
- package/skills/dx-devops-work-item-manage/examples/common-workflows.md +32 -0
- package/skills/dx-devops-work-item-manage/references/review-api.md +95 -0
- package/skills/dx-org-manage/SKILL.md +12 -12
- package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +1 -3
- package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +1 -3
- package/skills/dx-org-manage/references/opening-org.md +1 -1
- package/skills/dx-org-manage/references/scratch-org-operations.md +15 -20
- package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +1 -1
- package/skills/education-cloud-academic-calendar-generate/SKILL.md +2 -2
- package/skills/education-cloud-course-catalog-migrate/SKILL.md +1 -1
- package/skills/education-cloud-domain-configure/references/domain-features/recruitment-admissions.md +8 -7
- package/skills/education-cloud-multi-campus-configure/SKILL.md +1 -0
- package/skills/education-cloud-multi-campus-configure/references/error_handling.md +7 -6
- package/skills/education-cloud-student-recruitment-agent-configure/SKILL.md +2 -0
- package/skills/education-cloud-student-recruitment-agent-configure/references/customer-narration.md +2 -0
- package/skills/education-cloud-student-recruitment-agent-configure/references/flows.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/grounding.md +5 -4
- package/skills/education-cloud-student-recruitment-agent-configure/references/permissions.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/prerequisites.md +1 -1
- package/skills/education-cloud-student-recruitment-agent-configure/references/routing.md +1 -1
- package/skills/experience-cms-content-type-generate/SKILL.md +7 -6
- package/skills/experience-cms-content-type-generate/references/agent-checklist.md +3 -3
- package/skills/experience-cms-content-type-generate/references/anti-patterns.md +2 -2
- package/skills/experience-cms-content-type-generate/references/discovery-details.md +1 -1
- package/skills/experience-cms-content-type-generate/references/retrieve-and-reconcile.md +5 -9
- package/skills/experience-ui-bundle-custom-app-generate/scripts/resolve-uibundle-path.mjs +10 -0
- package/skills/field-service-data-capture-migrate/references/converter-builder-contract.md +2 -2
- package/skills/field-service-data-capture-migrate/references/fsm-dc-capability-catalog.md +2 -2
- package/skills/field-service-data-capture-migrate/scripts/analyze_flow.py +1 -1
- package/skills/field-service-data-capture-migrate/scripts/convert_to_dc_spec.py +1 -1
- package/skills/field-service-data-capture-migrate/scripts/fsm_dc_catalog.py +2 -2
- package/skills/field-service-data-capture-migrate/scripts/generate_summary.py +2 -2
- package/skills/platform-custom-application-generate/SKILL.md +97 -104
- package/skills/platform-custom-application-generate/references/app-properties.md +52 -0
- package/skills/platform-custom-application-generate/references/app-visibility.md +19 -0
- package/skills/platform-custom-application-generate/references/utility-bar.md +55 -0
- package/skills/platform-datamask-run/SKILL.md +1 -1
- package/skills/platform-datamask-run/references/policy-authoring.md +41 -18
- package/skills/platform-dsar-policy-manage/SKILL.md +7 -6
- package/skills/platform-dsar-policy-manage/references/export-and-history.md +10 -8
- package/skills/platform-dsar-policy-manage/references/report-format.md +4 -2
- package/skills/platform-metadata-grounding-get/SKILL.md +7 -7
- package/skills/platform-report-generate/SKILL.md +9 -7
- package/skills/platform-report-generate/references/column-names.md +12 -1
- package/skills/platform-report-generate/references/errors-and-troubleshooting.md +1 -1
- package/skills/platform-sharing-rules-generate/SKILL.md +12 -3
- package/skills/platform-sharing-rules-generate/references/rule-types.md +1 -0
- package/skills/service-agentforce-channel-configure/SKILL.md +6 -3
- package/skills/service-agentforce-channel-configure/references/agent-wiring.md +5 -3
- package/skills/service-agentforce-channel-configure/references/channel-branch-email.md +24 -15
- package/skills/service-agentforce-channel-configure/references/input-validation.md +23 -0
- package/skills/service-agentforce-channel-configure/references/live-traffic-gate.md +13 -7
- package/skills/service-agentforce-channel-configure/references/queue-resolution.md +3 -1
- package/skills/service-agentforce-human-escalation-configure/references/_vendored/input-validation.md +23 -0
- package/skills/service-agentforce-human-escalation-configure/references/_vendored/queue-resolution.md +146 -0
- package/skills/service-agentforce-human-escalation-configure/references/escalation-mechanism.md +1 -1
- package/skills/service-agentforce-human-escalation-configure/scripts/tests/_bootstrap.py +42 -11
- package/skills/service-agentforce-human-escalation-configure/scripts/tests/test_escalation_contracts.py +45 -0
- package/skills/service-agentforce-human-escalation-configure/scripts/verify-and-configure.sh +23 -9
- package/skills/service-de-channel-activate/SKILL.md +10 -10
- package/skills/service-de-channel-activate/references/gotchas.md +4 -4
- package/skills/service-de-channel-activate/references/phone-verification.md +43 -19
- package/skills/service-de-channel-create/SKILL.md +1 -1
- package/skills/service-de-channel-create/references/facebook.md +1 -1
- package/skills/service-de-channel-create/references/whatsapp.md +33 -6
- package/skills/service-de-channel-routing-configure/SKILL.md +5 -1
- package/skills/service-de-channel-routing-configure/references/gotchas.md +3 -1
- package/skills/service-de-channel-routing-configure/references/named-queue.md +39 -0
- package/skills/service-de-channel-settings-configure/SKILL.md +3 -1
- package/skills/service-de-channel-settings-configure/references/channel-settings-facets.md +2 -2
- package/skills/service-de-channel-settings-configure/references/gotchas.md +12 -1
- package/skills/service-de-headless-channel-configure/SKILL.md +68 -74
- package/skills/service-de-headless-channel-configure/references/gotchas.md +6 -2
- package/skills/service-de-headless-channel-configure/references/inputs.md +19 -0
- package/skills/service-de-headless-channel-configure/references/output-envelopes.md +23 -1
- package/skills/service-de-headless-channel-configure/references/partial-success.md +1 -0
- package/skills/service-de-headless-channel-configure/references/requested-settings.md +55 -0
- package/skills/service-de-headless-channel-configure/references/worked-examples.md +35 -1
- package/skills/service-digital-engagement-channel-configure/SKILL.md +3 -3
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +2 -2
- package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +1 -1
- package/skills/service-digital-engagement-deployment-configure/SKILL.md +2 -2
- package/skills/service-digital-engagement-deployment-configure/references/onboarding_contract.md +4 -2
- package/skills/service-digital-engagement-deployment-configure/scripts/check-api-version.sh +1 -1
- package/skills/service-omni-command-center-configure/SKILL.md +1 -1
- package/skills/data360-schema-get/SKILL.md +0 -388
- package/skills/data360-schema-get/references/README.md +0 -191
- package/skills/data360-schema-get/scripts/get_dlo_schema.py +0 -244
- package/skills/data360-schema-get/scripts/get_dmo_schema.py +0 -233
- package/skills/field-service-prework-brief-deployer-configure/SKILL.md +0 -646
- package/skills/field-service-voice-to-form-configure/SKILL.md +0 -650
|
@@ -1,269 +1,199 @@
|
|
|
1
|
-
# Data
|
|
1
|
+
# Data 360 Code Extension: Quick Reference
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Every block assumes it starts with the `<PY_ENV>` line from SKILL.md Phase 0b, in the same shell command:
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
- system mode: `export PATH="<user-base>/bin:$PATH"`, with the literal folder printed by `check_env.sh` (for example `/home/codebuilder/.local/bin`)
|
|
6
|
+
- venv mode: `source <PROJECT_DIR>/.venv/bin/activate`
|
|
7
|
+
|
|
8
|
+
Replace `<ORG_ALIAS>` and `<PROJECT_DIR>` with the real values.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
sf data-code-extension function init --package-dir <directory>
|
|
10
|
+
## Commands
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
sf data-code-extension script init --package-dir
|
|
12
|
+
### Initialize
|
|
13
|
+
```bash
|
|
14
|
+
sf data-code-extension script init --package-dir my_transform
|
|
15
|
+
sf data-code-extension function init --package-dir my_chunker --use-in-feature SearchIndexChunking
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
### Scan
|
|
18
|
+
### Scan (run from the package root)
|
|
19
19
|
```bash
|
|
20
|
-
# Basic scan
|
|
21
20
|
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py --
|
|
25
|
-
|
|
26
|
-
# Custom config location
|
|
27
|
-
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py --config ./custom-config.json
|
|
28
|
-
|
|
29
|
-
# Skip requirements.txt
|
|
30
|
-
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py --no-requirements
|
|
21
|
+
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py --dry-run # preview only
|
|
22
|
+
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py --no-requirements # keep requirements.txt (only when asked; never to get past PipreqsScanError)
|
|
23
|
+
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py --config-file ./alt-config.json
|
|
31
24
|
```
|
|
32
25
|
|
|
33
|
-
### Run
|
|
26
|
+
### Run locally
|
|
34
27
|
```bash
|
|
35
|
-
|
|
36
|
-
sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org <
|
|
37
|
-
|
|
38
|
-
# With custom config
|
|
39
|
-
sf data-code-extension script run --entrypoint ./payload/entrypoint.py -o <org_alias> -c custom-config.json
|
|
28
|
+
sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org <ORG_ALIAS>
|
|
29
|
+
sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org <ORG_ALIAS> --config-file ./alt-config.json
|
|
40
30
|
|
|
41
|
-
|
|
42
|
-
sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org afvibe
|
|
43
|
-
sf data-code-extension script run --entrypoint ./payload/entrypoint.py -o afvibe
|
|
31
|
+
sf data-code-extension function run --entrypoint ./payload/entrypoint.py --test-with ./payload/tests/test.json
|
|
44
32
|
```
|
|
45
33
|
|
|
46
|
-
### Deploy
|
|
34
|
+
### Deploy (Docker running, Code Extension enabled, user confirmed)
|
|
47
35
|
```bash
|
|
48
|
-
# Minimal deployment (MUST include --package-dir ./payload)
|
|
49
36
|
sf data-code-extension script deploy \
|
|
50
|
-
--target-org <
|
|
51
|
-
--name
|
|
52
|
-
--package-
|
|
53
|
-
--
|
|
54
|
-
--
|
|
55
|
-
|
|
56
|
-
# Full options
|
|
57
|
-
sf data-code-extension script deploy \
|
|
58
|
-
--target-org <org_alias> \
|
|
59
|
-
--name <name> \
|
|
60
|
-
--package-version <version> \
|
|
61
|
-
--description "<description>" \
|
|
62
|
-
--cpu-size <CPU_L|CPU_XL|CPU_2XL|CPU_4XL> \
|
|
63
|
-
--package-dir ./payload
|
|
64
|
-
|
|
65
|
-
# Examples (CRITICAL: Always include --package-dir ./payload)
|
|
66
|
-
sf data-code-extension script deploy \
|
|
67
|
-
--target-org afvibe \
|
|
68
|
-
--name Employee_Upper \
|
|
69
|
-
--package-version 1.0.0 \
|
|
70
|
-
--description "Uppercase employee positions" \
|
|
71
|
-
--package-dir ./payload
|
|
37
|
+
--target-org <ORG_ALIAS> \
|
|
38
|
+
--name my_transform \
|
|
39
|
+
--package-dir ./payload \
|
|
40
|
+
--package-version 0.0.1 \
|
|
41
|
+
--description "My transformation" \
|
|
42
|
+
--cpu-size CPU_2XL
|
|
72
43
|
```
|
|
73
44
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### New Project from Scratch
|
|
77
|
-
```bash
|
|
78
|
-
# 1. Create directory
|
|
79
|
-
mkdir my-transform && cd my-transform
|
|
80
|
-
|
|
81
|
-
# 2. Initialize
|
|
82
|
-
sf data-code-extension script init --package-dir .
|
|
45
|
+
`function deploy` takes the same flags. `script zip --package-dir ./payload` only builds the archive; `deploy` packages it for you.
|
|
83
46
|
|
|
84
|
-
|
|
47
|
+
## Package Layout
|
|
85
48
|
|
|
86
|
-
|
|
87
|
-
|
|
49
|
+
```text
|
|
50
|
+
<package_name>/ # package root: run scan, run, deploy from here
|
|
51
|
+
├── payload/ # what --package-dir points to on deploy
|
|
52
|
+
│ ├── entrypoint.py # your transformation
|
|
53
|
+
│ └── config.json # generated and updated by scan
|
|
54
|
+
├── examples/ # SDK sample (employee_hierarchy)
|
|
55
|
+
├── requirements.txt # updated by scan
|
|
56
|
+
├── requirements-dev.txt
|
|
57
|
+
├── Dockerfile, Dockerfile.dependencies, build_native_dependencies.sh
|
|
58
|
+
├── account.ipynb, jupyterlab.sh
|
|
59
|
+
└── README.md
|
|
60
|
+
```
|
|
88
61
|
|
|
89
|
-
|
|
90
|
-
sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org afvibe
|
|
62
|
+
A function package has `payload/entrypoint.py`, `payload/utility.py`, `payload/config.json`, plus `example/` folders with `tests/test.json` inputs.
|
|
91
63
|
|
|
92
|
-
|
|
93
|
-
sf data-code-extension script deploy \
|
|
94
|
-
--target-org afvibe \
|
|
95
|
-
--name MyTransform \
|
|
96
|
-
--package-version 1.0.0 \
|
|
97
|
-
--description "My transformation" \
|
|
98
|
-
--package-dir ./payload
|
|
99
|
-
```
|
|
64
|
+
## Workflows
|
|
100
65
|
|
|
101
|
-
###
|
|
66
|
+
### New project
|
|
102
67
|
```bash
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
68
|
+
<PY_ENV>
|
|
69
|
+
cd <PROJECT_DIR>
|
|
70
|
+
sf data-code-extension script init --package-dir my_transform
|
|
71
|
+
cd my_transform
|
|
72
|
+
# edit payload/entrypoint.py with real DLO names (the stock Account_std__dll usually doesn't exist)
|
|
106
73
|
sf data-code-extension script scan --entrypoint ./payload/entrypoint.py
|
|
74
|
+
sf data-code-extension script run --entrypoint ./payload/entrypoint.py --target-org <ORG_ALIAS>
|
|
75
|
+
# confirm with the user, then deploy (see above)
|
|
76
|
+
```
|
|
107
77
|
|
|
108
|
-
|
|
109
|
-
|
|
78
|
+
### Change code that's already deployed
|
|
79
|
+
A second `deploy` with the same `--name` fails with `DeploymentExists`, even with a new `--package-version`.
|
|
110
80
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-n MyTransform \
|
|
115
|
-
--package-version 1.1.0 \
|
|
116
|
-
--description "Updated transformation" \
|
|
117
|
-
--package-dir ./payload
|
|
118
|
-
```
|
|
81
|
+
1. Edit, `scan`, and `run` locally.
|
|
82
|
+
2. With the user's confirmation, delete the **data transform**, then the **code extension**. Use the UI or the Data 360 MCP delete tools.
|
|
83
|
+
3. Deploy again. You can keep the same name.
|
|
119
84
|
|
|
120
|
-
##
|
|
85
|
+
## PySpark Patterns
|
|
121
86
|
|
|
122
|
-
|
|
123
|
-
```python
|
|
124
|
-
from datacustomcode import Client
|
|
87
|
+
These patterns use made-up DLO and field names to show PySpark shapes. Never copy the names: use the source and target fields fetched in SKILL.md Phase 2.
|
|
125
88
|
|
|
126
|
-
|
|
89
|
+
`read_dlo` / `read_dmo` return **PySpark** DataFrames.
|
|
127
90
|
|
|
128
|
-
|
|
129
|
-
|
|
91
|
+
```python
|
|
92
|
+
from pyspark.sql.functions import col, concat_ws, upper, when, avg
|
|
130
93
|
|
|
131
|
-
|
|
132
|
-
|
|
94
|
+
from datacustomcode.client import Client
|
|
95
|
+
from datacustomcode.io.writer.base import WriteMode
|
|
133
96
|
|
|
134
|
-
|
|
135
|
-
client.write_to_dlo('Output__dll', df, 'overwrite')
|
|
97
|
+
client = Client()
|
|
136
98
|
```
|
|
137
99
|
|
|
138
|
-
###
|
|
100
|
+
### Select, rename, computed column
|
|
139
101
|
```python
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
102
|
+
df = client.read_dlo("Employee__dll")
|
|
103
|
+
out = (
|
|
104
|
+
df.select("id__c", "first_name__c", "last_name__c", "position__c")
|
|
105
|
+
.withColumn("full_name__c", concat_ws(" ", col("first_name__c"), col("last_name__c")))
|
|
106
|
+
.withColumn("position_upper__c", upper(col("position__c")))
|
|
107
|
+
)
|
|
108
|
+
client.write_to_dlo("Employee_Enriched__dll", out, WriteMode.OVERWRITE)
|
|
145
109
|
```
|
|
146
110
|
|
|
147
|
-
###
|
|
111
|
+
### Filter and conditional
|
|
148
112
|
```python
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
# Join
|
|
154
|
-
merged = employees.merge(departments, on='dept_id')
|
|
155
|
-
|
|
156
|
-
# Write multiple
|
|
157
|
-
client.write_to_dlo('Enriched__dll', merged, 'overwrite')
|
|
158
|
-
client.write_to_dmo('EmployeeDMO', merged, 'upsert')
|
|
113
|
+
active = df.filter(col("status__c") == "Active")
|
|
114
|
+
graded = active.withColumn(
|
|
115
|
+
"grade__c", when(col("position__c").contains("VP"), "Senior").otherwise("Junior")
|
|
116
|
+
)
|
|
159
117
|
```
|
|
160
118
|
|
|
161
|
-
###
|
|
119
|
+
### Join two DLOs
|
|
162
120
|
```python
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
active = df[df['status'] == 'Active']
|
|
167
|
-
|
|
168
|
-
# Computed column
|
|
169
|
-
df['full_name'] = df['first'] + ' ' + df['last']
|
|
170
|
-
|
|
171
|
-
# Aggregate
|
|
172
|
-
summary = df.groupby('dept')['salary'].mean()
|
|
173
|
-
|
|
174
|
-
# Conditional
|
|
175
|
-
df['grade'] = df['position'].apply(
|
|
176
|
-
lambda x: 'Senior' if 'VP' in x else 'Junior'
|
|
121
|
+
employees = client.read_dlo("Employee__dll")
|
|
122
|
+
departments = client.read_dlo("Department__dll").select(
|
|
123
|
+
col("id__c").alias("dept_id"), col("name__c").alias("department_name__c")
|
|
177
124
|
)
|
|
125
|
+
merged = employees.join(departments, employees["dept_id__c"] == col("dept_id"), "left").drop("dept_id")
|
|
126
|
+
client.write_to_dlo("Employee_With_Dept__dll", merged, WriteMode.OVERWRITE)
|
|
178
127
|
```
|
|
179
128
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
- `CPU_XL` - Medium datasets (1M-5M)
|
|
185
|
-
- `CPU_2XL` - Large datasets (5M-10M) **[default]**
|
|
186
|
-
- `CPU_4XL` - Very large (> 10M records)
|
|
129
|
+
### Aggregate
|
|
130
|
+
```python
|
|
131
|
+
summary = df.groupBy("department__c").agg(avg("salary__c").alias("avg_salary__c"))
|
|
132
|
+
```
|
|
187
133
|
|
|
188
|
-
###
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
134
|
+
### DMO to DMO
|
|
135
|
+
```python
|
|
136
|
+
ind = client.read_dmo("ssot__Individual__dlm")
|
|
137
|
+
client.write_to_dmo("Custom_Individual_Out__dlm", ind.select("ssot__Id__c", "ssot__FirstName__c"), WriteMode.MERGE)
|
|
138
|
+
```
|
|
193
139
|
|
|
194
|
-
|
|
140
|
+
### Layer rules (enforced by `scan`)
|
|
141
|
+
- Read DLOs **or** DMOs in one entry point, never both.
|
|
142
|
+
- DLO→DLO or DMO→DMO only. **Never read DLOs and write a DMO**, or the reverse.
|
|
143
|
+
- Pass object names as string literals so `scan` can detect them.
|
|
195
144
|
|
|
196
|
-
|
|
197
|
-
# Plugin not found
|
|
198
|
-
sf plugins install @salesforce/plugin-data-codeextension
|
|
145
|
+
## Write Modes (`WriteMode`)
|
|
199
146
|
|
|
200
|
-
|
|
201
|
-
|
|
147
|
+
| Mode | Use |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `APPEND` | Add rows |
|
|
150
|
+
| `OVERWRITE` | Replace all rows (full recompute) |
|
|
151
|
+
| `MERGE` | Merge on the primary key |
|
|
152
|
+
| `MERGE_UPSERT_DELETE` | Row-level `UPSERT`/`DELETE` via a `_merge_record_type` column |
|
|
153
|
+
| `OVERWRITE_PARTITIONS` | Deprecated, raises an error |
|
|
202
154
|
|
|
203
|
-
|
|
204
|
-
python --version
|
|
155
|
+
## Optional SDK Helpers
|
|
205
156
|
|
|
206
|
-
|
|
207
|
-
sf org login web --alias <org_alias>
|
|
157
|
+
See the template docstring in `payload/entrypoint.py`.
|
|
208
158
|
|
|
209
|
-
|
|
210
|
-
|
|
159
|
+
- `llm_gateway_generate_text_col(...)` generates column values with a configured model.
|
|
160
|
+
- `einstein_predict_col(...)` scores rows with an Einstein Studio model.
|
|
161
|
+
- `client.find_file_path("name")` resolves files bundled under `payload/files/`.
|
|
211
162
|
|
|
212
|
-
|
|
213
|
-
# Start Docker Desktop
|
|
214
|
-
```
|
|
163
|
+
## `--cpu-size`
|
|
215
164
|
|
|
216
|
-
|
|
165
|
+
| Size | Guidance |
|
|
166
|
+
|---|---|
|
|
167
|
+
| `CPU_L` | Small datasets (< 1M records) |
|
|
168
|
+
| `CPU_XL` | Medium (1M–5M) |
|
|
169
|
+
| `CPU_2XL` | Large (5M–10M), **default** |
|
|
170
|
+
| `CPU_4XL` | Very large (> 10M) |
|
|
217
171
|
|
|
218
|
-
|
|
219
|
-
my-project/
|
|
220
|
-
├── payload/
|
|
221
|
-
│ ├── entrypoint.py # Main code
|
|
222
|
-
│ └── config.json # Auto-generated permissions
|
|
223
|
-
├── requirements.txt # Auto-generated dependencies
|
|
224
|
-
└── README.md
|
|
225
|
-
```
|
|
172
|
+
Higher sizes may use more quota or credits.
|
|
226
173
|
|
|
227
|
-
## config.json
|
|
174
|
+
## `config.json` (generated by scan)
|
|
228
175
|
|
|
229
176
|
```json
|
|
230
177
|
{
|
|
231
|
-
"
|
|
178
|
+
"sdkVersion": "6.1.0",
|
|
179
|
+
"entryPoint": "entrypoint.py",
|
|
180
|
+
"dataspace": "default",
|
|
232
181
|
"permissions": {
|
|
233
|
-
"read": ["Employee__dll", "Department__dll"],
|
|
234
|
-
"write": ["
|
|
235
|
-
},
|
|
236
|
-
"resources": {
|
|
237
|
-
"cpu_size": "CPU_2XL"
|
|
182
|
+
"read": { "dlo": ["Employee__dll", "Department__dll"] },
|
|
183
|
+
"write": { "dlo": ["Employee_With_Dept__dll"] }
|
|
238
184
|
}
|
|
239
185
|
}
|
|
240
186
|
```
|
|
241
187
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
| Error | Quick Fix |
|
|
245
|
-
|-------|-----------|
|
|
246
|
-
| Plugin not found | `sf plugins install @salesforce/plugin-data-codeextension` |
|
|
247
|
-
| Python SDK missing | `pip install salesforce-data-customcode` |
|
|
248
|
-
| Wrong Python version | Use pyenv to install 3.11.0 |
|
|
249
|
-
| Org not connected | `sf org login web --alias <alias>` |
|
|
250
|
-
| Config missing | Run scan command |
|
|
251
|
-
| DLO not found | Check DLO name, use data360-schema-get skill |
|
|
252
|
-
| Docker error | Start Docker Desktop |
|
|
188
|
+
Don't hand-edit `permissions`; rerun `scan`. Edit `dataspace` only if you use a non-default data space.
|
|
253
189
|
|
|
254
190
|
## Deployment Checklist
|
|
255
191
|
|
|
256
|
-
- [ ]
|
|
257
|
-
- [ ]
|
|
258
|
-
- [ ]
|
|
259
|
-
- [ ]
|
|
260
|
-
- [ ]
|
|
261
|
-
- [ ]
|
|
262
|
-
- [ ]
|
|
263
|
-
- [ ]
|
|
264
|
-
|
|
265
|
-
## Resources
|
|
266
|
-
|
|
267
|
-
- Plugin: https://github.com/salesforcecli/plugin-data-code-extension
|
|
268
|
-
- Python SDK: https://github.com/forcedotcom/datacloud-customcode-python-sdk
|
|
269
|
-
- Data Cloud Docs: https://help.salesforce.com/s/articleView?id=sf.c360_a_intro.htm
|
|
192
|
+
- [ ] `check_env.sh` all ✅ (Docker running)
|
|
193
|
+
- [ ] **Code Extension** enabled in Data Cloud Setup → Feature Manager (manual)
|
|
194
|
+
- [ ] Source and target schemas fetched and field mapping printed before the code was written (Phase 2)
|
|
195
|
+
- [ ] `scan` rerun after the last code change
|
|
196
|
+
- [ ] Local `run` succeeds
|
|
197
|
+
- [ ] Output DLO not used by another data transform
|
|
198
|
+
- [ ] No existing code extension with the same `--name` (or it was deleted)
|
|
199
|
+
- [ ] User confirmed the deploy
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Reading a Deployed Run's Logs (`DataCustomCodeLogs__dll`)
|
|
2
|
+
|
|
3
|
+
Everything the deployed code prints or logs, including uncaught exceptions and tracebacks, is written to the system DLO **`DataCustomCodeLogs__dll`**, one row per message. Check it after every run (SKILL.md Phase 7), whether the run succeeded or failed.
|
|
4
|
+
|
|
5
|
+
| Field | Meaning |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `DataCustomCodeName__c` | Name of the code extension (the deploy `--name`). Filter on this |
|
|
8
|
+
| `ExecutionId__c` | One value per run. All rows of a run share it |
|
|
9
|
+
| `Timestamp__c` | When the message was written. The newest rows are the latest run |
|
|
10
|
+
| `Message__c` | The printed or logged text, or the exception |
|
|
11
|
+
|
|
12
|
+
## Latest run
|
|
13
|
+
|
|
14
|
+
This returns every message from the **latest run** of `<name>`, in order. When the Data 360 MCP server is available, send the same SQL with its `d360_query_sql` tool first; use this command as the fallback:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
sf api request rest "/services/data/v<API_VERSION>/ssot/query-sql" --method POST --target-org <ORG_ALIAS> --body - <<'EOF' \
|
|
18
|
+
| jq -r '"rows: \(.returnedRows)", (.data[] | "\(.[0]) \(.[2])")'
|
|
19
|
+
{"sql": "SELECT Timestamp__c, ExecutionId__c, Message__c FROM DataCustomCodeLogs__dll WHERE DataCustomCodeName__c = '<name>' AND ExecutionId__c = (SELECT ExecutionId__c FROM DataCustomCodeLogs__dll WHERE DataCustomCodeName__c = '<name>' ORDER BY Timestamp__c DESC LIMIT 1) ORDER BY Timestamp__c"}
|
|
20
|
+
EOF
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`--body -` reads the JSON request from the quoted heredoc, so the command needs no `$(…)`. Keep `<name>` free of `"` and `'`.
|
|
24
|
+
|
|
25
|
+
## Reading the rows
|
|
26
|
+
|
|
27
|
+
- Confirm the run is the one you just started: the newest `Timestamp__c` should be after you clicked Run Now. Log rows can take a few minutes to appear. If there are none, or only an older run's rows, wait and query again.
|
|
28
|
+
- Look in `Message__c` for `Traceback`, `Error` or `Exception` lines. They give the failing line in `entrypoint.py`.
|
|
29
|
+
- To see the last few runs at a glance, send this SQL the same way: `SELECT ExecutionId__c, MIN(Timestamp__c), MAX(Timestamp__c), COUNT(*) FROM DataCustomCodeLogs__dll WHERE DataCustomCodeName__c = '<name>' GROUP BY ExecutionId__c ORDER BY 2 DESC LIMIT 5`.
|
|
30
|
+
- In the UI, use **Data Explorer**: choose `DataCustomCodeLogs__dll` and filter on `DataCustomCodeName__c`.
|
|
31
|
+
- Add `print()` or `logging` calls to the code to trace a deployed run, then redeploy. Local `run` prints to the terminal instead.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Discovering Source and Target Schemas
|
|
2
|
+
|
|
3
|
+
Commands for SKILL.md Phase 2. Use the first option that's available and tell the user which one you used. **If the Data 360 MCP server is connected, you must use it**; don't switch to the `sf api` fallback just because it has a ready-made command.
|
|
4
|
+
|
|
5
|
+
## 1. Data 360 MCP server (default)
|
|
6
|
+
|
|
7
|
+
Use the MCP check from SKILL.md Phase 0b. If Phase 0b didn't run in this session (for example the user asked straight for a code change), do that check now, before the first lookup.
|
|
8
|
+
|
|
9
|
+
- **Fields:** call `payload_examples` for `d360_dlo_get`, then `execute` it with the DLO name. One call per DLO.
|
|
10
|
+
- If `d360_dlo_get` isn't found, call `search` with "get DLO schema fields". Pass only the query; the server rejects `limit`.
|
|
11
|
+
- **Sample data:** `execute` `d360_query_sql` with `SELECT <field1>, <field2> FROM <INPUT_DLO> LIMIT 20`.
|
|
12
|
+
|
|
13
|
+
Tool details: [mcp-integration.md](mcp-integration.md).
|
|
14
|
+
|
|
15
|
+
## 2. Fallback only: `sf api`
|
|
16
|
+
|
|
17
|
+
Use this only when the MCP server isn't connected or its call failed, and say which. Use the `API_VERSION` printed by `check_env.sh`. These commands don't need `<PY_ENV>`.
|
|
18
|
+
|
|
19
|
+
### DLO fields
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
sf api request rest "/services/data/v<API_VERSION>/ssot/data-lake-objects/<DLO_NAME>" --target-org <ORG_ALIAS> 2>/dev/null \
|
|
23
|
+
| jq '.dataLakeObjects[0] | {name, fields: [.fields[] | {name, dataType}]}'
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The response wraps the object in an array: `{"dataLakeObjects": [{"name", "label", "fields": [{"name", "label", "dataType"}], ...}]}`. Read it with `.dataLakeObjects[0]`; a top-level `.fields` is null. Run one call per DLO, and compare `dataType` for fields you join or compare (for example, a Number key joined to a Text key needs a cast).
|
|
27
|
+
|
|
28
|
+
### Sample input data
|
|
29
|
+
|
|
30
|
+
Look at the input data before you write join or filter logic, especially self-joins and root conditions (null vs `0`). Parse with `jq`, not `python3 -c`: agent hosts treat inline interpreters like `eval` and ask for approval.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
sf api request rest "/services/data/v<API_VERSION>/ssot/query-sql" --method POST --target-org <ORG_ALIAS> --body - <<'EOF' 2>/dev/null \
|
|
34
|
+
| jq -c '.data[]'
|
|
35
|
+
{"sql": "SELECT <field1>, <field2> FROM <INPUT_DLO> LIMIT 20"}
|
|
36
|
+
EOF
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 3. UI
|
|
40
|
+
|
|
41
|
+
Data Cloud → **Data Lake Objects**, then open the object and check the field API names.
|
|
42
|
+
|
|
43
|
+
## Lowercase column names
|
|
44
|
+
|
|
45
|
+
Code extensions support only lowercase column names. The SDK lowercases every column it reads (`read_dlo` returns `kq_id__c`, not `KQ_id__c`), and writes accept only lowercase names, so a target field whose API name has a capital letter can't be written. Write only the target's own lowercase fields, computed ones included, end the code with an explicit `select()` of them, and refer to them by their lowercase names. Don't pass every source column through.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Troubleshooting Data 360 Code Extensions
|
|
2
|
+
|
|
3
|
+
| Symptom | Cause | Fix |
|
|
4
|
+
|---|---|---|
|
|
5
|
+
| `EPERM: operation not permitted, open '~/.sf/sf-<date>.log'`, or the check prints "sf CLI is installed but can't run in this shell" | The agent host's sandbox blocks `sf` from writing its log and config folders. The plugin and org checks then show false ❌s | Rerun the command with the host's permission to run outside the sandbox |
|
|
6
|
+
| `PackageNotInstalled: salesforce-data-customcode` on `init` | Phase 1 started before the SDK was installed in this project's Python | Install the SDK and `pipreqs` into `<PROJECT_DIR>/.venv` (or `--user` in system mode), wait for it to finish, rerun `check_env.sh`, then `init`. Don't borrow another project's venv |
|
|
7
|
+
| `command data-code-extension not found` | Plugin not installed | `sf plugins install @salesforce/plugin-data-code-extension` |
|
|
8
|
+
| `PythonVersionMismatch: ... exactly version 3.11 is required` | `python3` on `PATH` isn't 3.11 | Venv mode: start the same block with `source <PROJECT_DIR>/.venv/bin/activate`. System mode: the default `python3` isn't 3.11, so switch to venv mode (environment-setup.md §3b) |
|
|
9
|
+
| `pip install` "worked" but `import datacustomcode` fails | The venv has no pip (created with `uv venv`), so the global pip was used | Recreate with `python3.11 -m venv .venv` and always use `python3 -m pip` |
|
|
10
|
+
| `uv pip install` hangs | uv network/index issue | Use `python3 -m pip` inside the venv |
|
|
11
|
+
| `PipreqsScanError` during `scan` | `pipreqs` not installed, or (system mode) installed with `--user` into a `bin` folder that isn't on `PATH` | `python3 -m pip install [--user] pipreqs`, and start the block with `<PY_ENV>` (system mode adds the user-base `bin` folder, for example `~/.local/bin`, to `PATH`). `check_env.sh` prints the exact install command. Then rerun the same `scan`; don't switch to `--no-requirements` to get past it |
|
|
12
|
+
| `PYTHON_VERSION_MISMATCH ... worker (3, x) ... driver 3.11` | Venv mode: Spark workers use the global `python3` because the PySpark hook is missing (for example, the venv was recreated) | `bash <SKILL_DIR>/scripts/venv_hook.sh <PROJECT_DIR>`, then activate the venv again |
|
|
13
|
+
| `error: externally-managed-environment` on `pip install` | System mode on a PEP 668 distro (Debian 12+, Ubuntu 23.04+) | Use venv mode. Don't use `--break-system-packages` |
|
|
14
|
+
| Plugin finds the SDK, but `run` fails with `ModuleNotFoundError: datacustomcode` | System mode: SDK installed with a `pip3` that belongs to another Python. The plugin accepts the package from any pip | Reinstall with `python3 -m pip install --user salesforce-data-customcode` |
|
|
15
|
+
| `python3 -m pip`: `No module named pip` | System mode: the 3.11 interpreter has no pip | `apt install python3-pip` (user action, sudo), or `python3 -m ensurepip --user` |
|
|
16
|
+
| `UnsupportedOperationException: sun.misc.Unsafe or java.nio.DirectByteBuffer.<init>(long, int) not available` during local `run` | JDK 21 with PySpark 3.5: Arrow `toPandas()` (and likely pandas UDFs) isn't supported | Use JDK 17 (`JAVA_HOME`), or set `spark.sql.execution.arrow.pyspark.enabled` to `false` before `toPandas()`. JVM flags don't fix it. See environment-setup.md §Java |
|
|
17
|
+
| `Java gateway process exited` / `JAVA_HOME is not set` | No JDK found | Install JDK 17 (see environment-setup.md §Java). On macOS, check with `/usr/libexec/java_home -V` |
|
|
18
|
+
| `Cannot read from DLO and DMO in the same file` | Entry point reads both layers | Read only DLOs or only DMOs |
|
|
19
|
+
| `Cannot read from DLO and write to DMO in the same file` (or the reverse) | Mixed layers | DLO→DLO or DMO→DMO. Split the logic into separate code extensions |
|
|
20
|
+
| `Must read from at least one DLO or DMO` | No `read_dlo` / `read_dmo` call `scan` can detect | Call `client.read_dlo("<name>")` with a string literal |
|
|
21
|
+
| `AttributeError: 'DataFrame' object has no attribute 'str'` or similar | pandas syntax used on a PySpark DataFrame | Use PySpark (`withColumn`, `upper(col(...))`), or `.toPandas()` for small data only |
|
|
22
|
+
| `run` fails with `table does not exist` | DLO name doesn't exist in this org (for example the stock `Account_std__dll`) | Use real DLO API names (SKILL.md Phase 2) |
|
|
23
|
+
| `run` succeeds but the target DLO stays empty | Local run uses `PrintDataCloudWriter` | Expected. Deploy, then run the data transform |
|
|
24
|
+
| `run` exits 1 with no traceback | The command had `2>/dev/null`; the traceback goes to stderr | Rerun without redirecting stderr |
|
|
25
|
+
| `ValueError: The following columns are not present in the DLO '<output>'` | Code extensions support lowercase column names only. The SDK lowercases the columns it reads (`reader/utils.py`: `column.lower()`), and writes accept only lowercase names, so every listed column has a capital letter, for example `KQ_id__c`, `DataSource__c`, `DataSourceObject__c`, `InternalOrganization__c`, `cdp_sys_SourceVersion__c` | Leave out the standard ingestion fields. For a field the user needs, add a lowercase field to the target DLO in Data Cloud and write that (SKILL.md Phase 2) |
|
|
26
|
+
| `run` succeeds but the printed table has no rows | Filter or join matched nothing: root condition (`isNull()` vs `0`), or Number vs Text join keys (Number reads as `1.0`) | Query the input data with `jq` (schema-discovery.md); cast with `.cast("long").cast("string")` |
|
|
27
|
+
| Approval prompt for a query command that parses JSON with `python3 -c` | Agent hosts treat inline interpreters like `eval` | Parse with `jq` instead |
|
|
28
|
+
| `run` shows only ~1000 rows | Local reader default `default_row_limit: 1000` | Expected for local testing |
|
|
29
|
+
| Wrong org or expired-token error | Command used the CLI default org | Pass `--target-org <ORG_ALIAS>` |
|
|
30
|
+
| `Error (2): Nonexistent flag: --target-org` | `init`, `scan` and `zip` don't accept `--target-org` | Remove the flag; only `run` and `deploy` take it |
|
|
31
|
+
| The agent host asks for approval on every command ("command-substitution or eval pattern") | Commands contain `$(…)`, backticks or `eval` | Copy the literal `PY_ENV=` and `API_VERSION=` lines printed by `check_env.sh`; send SQL bodies with `--body -` and a quoted heredoc |
|
|
32
|
+
| `--json` parse errors from `sf` (`jq: parse error`) | stderr merged into stdout with `2>&1`, so warnings such as "update available" got into the JSON | Remove `2>&1`; use `2>/dev/null` if you want quiet output |
|
|
33
|
+
| `jq: error ... Cannot iterate over null` when reading DLO fields | The `ssot/data-lake-objects/<DLO_NAME>` response wraps the object in a `dataLakeObjects` array, so a top-level `.fields` is null | Use `jq '.dataLakeObjects[0] \| {name, fields: [.fields[] \| {name, dataType}]}'` (schema-discovery.md) |
|
|
34
|
+
| MCP `search` fails with `JSON_PARSER_ERROR: Unrecognized field "limit"` | The server rejects the `limit` parameter that the tool schema advertises | Call `search` with the query only |
|
|
35
|
+
| Agent uses `sf api` although the Data 360 MCP server is connected | MCP tools are listed as deferred (name only) and the agent treated them as unavailable, or the session skipped Phase 0 so the MCP check never ran | Agent Rule 9: check the tool list, including deferred tools, before the first org lookup in every session |
|
|
36
|
+
| MCP call fails with `Streamable HTTP error ... 404 ... Session not found` | The MCP server expired the client's session after it sat idle | Retry the call once (many clients reconnect on the next call). If it fails again, use the `sf api` fallback and reconnect or restart the Data 360 MCP server in the agent's MCP settings |
|
|
37
|
+
| `sf org login web` fails | Wrong instance URL | Use the org's My Domain URL, or `https://test.salesforce.com` for sandboxes |
|
|
38
|
+
| `deploy` fails with a feature/permission error | Code Extension not enabled, or missing Data 360 permissions | User enables **Data Cloud Setup → Feature Manager → Code Extension** (UI only), and checks the user's Data 360 permissions |
|
|
39
|
+
| `deploy` fails with a Docker error | Docker Desktop not running | Start Docker Desktop. Check with `docker info` |
|
|
40
|
+
| `deploy` fails, package not found / wrong layout | `--package-dir` points at the package root | `--package-dir ./payload` |
|
|
41
|
+
| `deploy` fails with `DeploymentExists` | A code extension with that `--name` already exists. A new `--package-version` doesn't help | Delete the data transform, then the code extension, then redeploy (confirm with the user first) |
|
|
42
|
+
| `deploy` fails with `Output objects ... are already in use` | Another data transform already writes to that DLO | Delete that transform, or write to a different DLO |
|
|
43
|
+
| Deployed transform runs but output is wrong or missing | Schema mismatch between written columns and the output DLO | Compare the DataFrame columns with the DLO fields (Phase 2). Check the run history in Data Transforms or with MCP `d360_code_extension_executions_list`, and read the run's messages in `DataCustomCodeLogs__dll` (run-logs.md) |
|
|
44
|
+
| Deployed run fails | An exception in the code | Query `DataCustomCodeLogs__dll` for the latest `ExecutionId__c` of the code extension and read the traceback in `Message__c` (run-logs.md) |
|
|
45
|
+
| `function run` asks for `--test-with` | Functions are tested with input JSON, not org data | `--test-with ./payload/tests/test.json` (see `example/*/tests/test.json`) |
|