Question:
Can’t I define a JS function in the DOM Header and later use it in namedFunctions or field calcs?
Solution:
You can attach the function to the global window object:
Window.myFunction = yourFunction;
This allows you to define the function globally and access it from different scopes. This solution might resolve issues where the function is not recognized when defined in a DOM Header Insertion but works when defined in a namedAction.