Repository navigation
Conversation
Retain parent name and type fields and nested internal reference details in OmniStudio exports without changing deployment matching definitions. Preserve structured JSON field values through export and deployment using explicit field declarations, while retaining ordinary text references. Compare compatibility fields against Build Tools output and cover JSON round trips and reference handling with regression tests. Refs #476
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Keep read-only values in exported datapacks and let deployment filter fields Salesforce cannot write. Remove the includeReadOnly option and retain explicit output exclusions through ignoreFields. Refs #476
There was a problem hiding this comment.
🔵 Needs a closer look
The change alters core DataPack export and deployment JSON round-trip semantics affecting real customer output, and correctness depends on parity tests requiring runtime validation that cannot be executed here.
No open issues 🎉
What changed in this PR
This PR restores OmniStudio export output to match Salesforce Build Tools after a regression introduced in v2.4.5 (issue #476). It reintroduces two legacy behaviors without altering deployment matching/lookup criteria: (1) internal matching references again carry legacy display/identity fields (e.g. Name, owning-script references, ParentElementName/ParentElementType), and (2) structured JSON payload fields (e.g. PropertySetConfig) are preserved verbatim through export expansion and serialized back to strings on deployment — even when the payload is shaped like a record/reference or contains empty containers and nulls. New declarative knobs (referenceFields, field-level includeReadOnly) drive this via the bundled export definitions, and the fix spans both the export and deployment (datapackRecordFactory) sides so values round-trip losslessly.
Changes:
- Added
referenceFields(object-level) andincludeReadOnly(field-level) config, wired through the TS interfaces, generated JSON schema, and bundled OmniStudio standard/managed YAML definitions. - Export pipeline now preserves parsed-JSON documents as-is (no null-policy/export-key rewriting, no treating payload objects as dependencies) and copies legacy
referenceFieldsonto internal matching references; deployment re-serializes JSON payload fields back to text instead of resolving them as lookups. - Strengthened parity fixtures/tests to compare full internal references against Build Tools output, plus new round-trip and reference-handling regression tests.
| File | Description |
|---|---|
export/exportDefinitions.ts |
Adds referenceFields and includeReadOnly interface fields with doc comments. |
export/exportDefinitions.schema.json |
Regenerated schema reflecting the two new properties. |
exportDefinitions/omnistudioStandardDatapackDefinitions.yaml |
Adds referenceFields and includeReadOnly parent name/type fields for standard runtime. |
exportDefinitions/omnistudioManagedDatapackDefinitions.yaml |
Same additions for the managed/namespaced runtime. |
export/datapackNormalizer.ts |
Preserves parsed-JSON object/array field values instead of normalizing them as SObject graphs. |
export/datapackExportKeys.ts |
Skips JSON fields during collect/rewrite and merges referenceFields onto internal references. |
export/datapackExporter.ts |
Honors includeReadOnly so flagged calculated/auto-number fields are kept in output. |
datapackRecordFactory.ts |
Builds a bundled-definition store to re-serialize JSON payload fields to strings on deployment rather than treating them as dependencies. |
__tests__/datapackRecordFactory.test.ts |
New test ensuring non-JSON object fields still become lookups. |
__tests__/datapackExporter.test.ts |
New round-trip test across payload shapes; parity comparable() now compares full references; marks parent fields calculated. |
__tests__/__fixtures__/exportParity/*.json |
Oracle fixtures updated to include legacy reference/parent fields. |
__tests__/__fixtures__/exportParity/generate.mjs |
Emits parent name/type and nested owner references when regenerating oracles. |
__tests__/__fixtures__/exportParity/README.md |
Documents narrowed normalization boundaries. |
README.md |
Documents referenceFields, includeReadOnly, and JSON-payload preservation/serialization semantics. |
Review effort: Balanced
Use the existing JSON serialization and reference handling. Remove the extra definition store and speculative reserved-marker handling. Preserve empty JSON arrays, which have no items for the existing conversion loop to visit. Retain round-trip coverage for ordinary JSON values and dependency coverage for text fields. Refs #476
Keep calculated and auto-number exclusions and existing internal reference output. Remove the speculative compatibility options and fixture changes that only reproduced harmless legacy JSON differences. Retain the reproduced empty-array serialization fix and regression tests for JSON values and ordinary references. Refs #476
|




Retain parent name and type fields and nested internal reference details in OmniStudio exports without changing deployment matching definitions.
Preserve structured JSON field values through export and deployment using explicit field declarations, while retaining ordinary text references. Compare compatibility fields against Build Tools output and cover JSON round trips and reference handling with regression tests.
Refs #476