MemberJunction / MemberJunction/MJ
Lists/Communication: SendToAudience loads only PK + recipient + name — templates cannot see row fields
- Dominant language
- TSQL
- Stars
- 29
- Forks
- 6
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 323
Description
## What's wrong
`SendToAudience` resolves an audience and fans out per-recipient messages, but its bulk load projects only `[primary key, RecipientField, FullNameField]`. The per-recipient `ContextData` is set to that loaded row — so message templates cannot reference any other column of the audience rows (e.g. a per-row token, company, status, or URL), which defeats per-recipient personalization for most real audiences.
Related sharp edge worth fixing or documenting in the same pass: in `Engine.SendMessages`, a recipient's `ContextData` wholesale REPLACES the base message's `ContextData` (even when `undefined`) rather than merging — shared base context must be duplicated into every recipient by the caller.
Found while evaluating SendToAudience for "email N invite rows with per-row unique links" — the projection made it a non-starter despite the audience/fan-out machinery being exactly right.
## Proposed shape
Either load the full row for `ContextData`, or (better for wide tables) accept an optional field-projection list on the audience source / send call. Document or fix the replace-vs-merge semantics for recipient ContextData.
## Acceptance criteria
- [ ] A SendToAudience template can reference arbitrary fields of the audience entity's rows (full row or explicit projection)
- [ ] ContextData replace-vs-merge behavior is explicit (documented or merged with a defined precedence)
- [ ] Existing SendToAudience consumers are unaffected by default
## Blocked by
None - can start immediately
Contributor guide
Assessment
This issue has not been assessed yet.