Add a shared helper for lookup field case normalization - #310
Open
labkey-martyp wants to merge 1 commit into
Open
Add a shared helper for lookup field case normalization#310labkey-martyp wants to merge 1 commit into
labkey-martyp wants to merge 1 commit into
Conversation
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.
This was referenced Sep 8, 2026
Open
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.
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
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.Tasks