How to get the property(env value) of subflow with it's node

I have designed a custom Node-RED node with a filename parameter, which is currently parsed as a plain string.

I would like to allow this parameter to accept dynamic values—for example, by referencing a property defined in a subflow (e.g., msg.filename or a subflow environment variable).

What’s the best way to achieve this?

Ideally, the custom node should support both:

  • static strings (e.g., /data/file.csv), and
  • dynamic expressions (e.g., msg.filename or flow.filename) that are evaluated at runtime.

How should I implement this in the custom node to support both modes?

If you are making a custom node then be better way to do this is using a TypedInput widget- TypedInput Widget : Node-RED

There are some examples at the bottom of that doc.

I would suggest you add str, env for flexibility (but if you read the env-var docs, a str field can use env vars too, its just not a flexible as the $env field.