Skip to content

Add a shared helper for lookup field case normalization - #310

Open
labkey-martyp wants to merge 1 commit into
release26.3-SNAPSHOTfrom
26.3_fb_shared_lookup_normalization
Open

Add a shared helper for lookup field case normalization#310
labkey-martyp wants to merge 1 commit into
release26.3-SNAPSHOTfrom
26.3_fb_shared_lookup_normalization

Conversation

@labkey-martyp

@labkey-martyp labkey-martyp commented Sep 8, 2026

Copy link
Copy Markdown

Rationale

Eleven trigger scripts across the EHR compliance and ONPRC modules had each copied the same loop for case-normalizing lookup values on write, so this adds the single shared implementation they can call instead. The helper takes the LookupValidationHelper as an argument rather than constructing one, because that class caches each lookup target's allowable values per instance: callers keep creating it at script scope, where the target table is read once per batch instead of once per row.

Related Pull Requests

This must merge and deploy first. A consumer script that requires the new function against an un-updated LDK fails at script compile time.

Changes

  • Adds LDK.Server.Utils.normalizeLookupFields, which replaces each named field's value with the canonically-cased value from its lookup target and reports a field error for any value the target does not contain.
  • Documents why the validation helper is a parameter, since creating one per call would silently turn a per-batch read of each lookup target into a per-row read.

Tasks

  • Claude Code Review
  • Code Review

Nine trigger scripts across the compliance and SSU modules had each copied this loop verbatim. The LookupValidationHelper is passed in rather than created internally so callers keep it at script scope, where its cache of allowable values is read once per batch instead of once per row.
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.

1 participant