Skip to content

Fix embedded object exports failing due to unresolved namespace tokens in filter evaluation - #475

Draft
Codeneos with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-vlocity-exports-issues
Draft

Fix embedded object exports failing due to unresolved namespace tokens in filter evaluation#475
Codeneos with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-vlocity-exports-issues

Conversation

Copilot AI commented Aug 21, 2026

Copy link
Copy Markdown

Exporting OmniScripts (and other datapacks with embedded objects) fails with Filter evaluated to empty object for embedded object %vlocity_namespace%__Element__c because the new local exporter never resolves %vlocity_namespace% placeholders before evaluating embedded-object filters.

Root cause

Export definitions use %vlocity_namespace% tokens in both filter keys and values:

filter:
  '%vlocity_namespace%__OmniScriptId__c': '{%vlocity_namespace%__OmniScript__c:Id}'

evalFilterValueExp builds a lookup context keyed by the real resolved type (e.g. vlocity_cmt__OmniScript__c), so context['%vlocity_namespace%__OmniScript__c'] always returns undefined → filter collapses to empty → exception. Filter object keys (%vlocity_namespace%__OmniScriptId__c) were also forwarded unresolved to Salesforce queries.

Changes

  • datapackExporter.tsevalFilterValueExp: call this.salesforce.updateNamespace(stringFormat) before the context lookup so path segments match the resolved object type keys.
  • datapackExporter.tsbuildLookupFilter: resolve namespace tokens in each filter object key via this.salesforce.updateNamespace(key) before building the query filter.
  • datapackExporter.test.ts: add updateNamespace mock to all three inline salesforce mocks; add a dedicated test verifying namespace token resolution in both filter keys and values.

Copilot AI linked an issue Aug 21, 2026 that may be closed by this pull request
Vlocity exports were failing with "Filter evaluated to empty object for
embedded object %vlocity_namespace%__Element__c on OmniScript__c" because
the filter evaluation code in the new local exporter did not resolve the
%vlocity_namespace% placeholder tokens before:

1. Looking up values in the context object (evalFilterValueExp) – the
   context is keyed by the real resolved namespace (e.g.
   vlocity_cmt__OmniScript__c) but the filter template still contained the
   raw token, so every path lookup returned undefined.

2. Using filter object keys as Salesforce field names (buildLookupFilter) –
   the keys were passed to Salesforce queries with the raw token instead of
   the actual field name.

Fix: call this.salesforce.updateNamespace() on the filter string template
in evalFilterValueExp and on each filter object key in buildLookupFilter.

Also adds updateNamespace to every inline salesforce mock in
datapackExporter.test.ts and a dedicated test case for namespace token
resolution in filter keys and values.

Closes #474
Copilot AI changed the title [WIP] Fix Vlocity exports issues on version 2.4.1 Fix embedded object exports failing due to unresolved namespace tokens in filter evaluation Aug 21, 2026
Copilot AI requested a review from Codeneos August 21, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vlocity Exports Issues on Version 2.4.1

2 participants