fix: Handle dots in custom field names for segments, workflows, and templates#347
Open
chamby wants to merge 1 commit intouseplunk:nextfrom
Open
fix: Handle dots in custom field names for segments, workflows, and templates#347chamby wants to merge 1 commit intouseplunk:nextfrom
chamby wants to merge 1 commit intouseplunk:nextfrom
Conversation
…emplates
Custom fields with dots in their names (e.g., "prefix.key") were broken
because the code split on "." to build path lookups, interpreting them as
nested paths instead of literal flat JSON keys.
- SegmentService: Use [jsonPath] instead of jsonPath.split('.') since
contact data is always a flat JSON object
- WorkflowExecutionService: Split only on the first dot to separate the
top-level field from the custom field name
- template.ts: Use recursive first-dot splitting with direct key lookup
before descending into nested objects
Fixes useplunk#346
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
prefix.key) were silently broken across segment filtering, workflow conditions, and email template rendering because the code split on.to build path lookups, treating them as nested JSON paths instead of literal flat keysSegmentService,WorkflowExecutionService, andtemplate.tsto preserve dots in custom field namesFixes #346
Changes
SegmentService.buildJsonFieldCondition— Use[jsonPath](single-element array) instead ofjsonPath.split('.'). Contact data is always a flat JSON object, so the Prisma JSON path should always be a single key.WorkflowExecutionService.resolveField— Split only on the first.to separate the top-level field name (data) from the custom field name (prefix.key), instead of splitting on every..template.tsgetValue— Replacesplit('.').reduce()with a recursive function that tries direct key lookup at each level before descending via dot-splitting. Fordata.prefix.key, it entersdata, then findsprefix.keyas a literal key.Test plan
data.app.plan){{data.prefix.key}}correctlydata.plan,data.firstName) continue to work🤖 Generated with Claude Code