Custom Node Dynamic Field Generation

Is it possible or on the roadmap to create dynamic fields in a custom node? I assume not since node fields are static at build time.

I am working on a node for a product API that is user configurable. I therefore cannot know the required data for the API until a user configures credentials and calls the API. What I’d like to do is inside the custom node call the API config endpoint and dynamically create the input fields for the node.

I wouldn’t think so either tbh, but perhaps @marcus has an idea on this one.

Hi @ryanflomenco,
as you already understood we don’t have the option to dyanmically create node properties at the moment and we also don’t have a plan to do so in the near future.

At this point you could use displayOptions to hide/show properties depending on other node properties.

If it’s just things like custom fields, you may be able to use the very new Node UI elements | n8n Docs

But if it’s the entire API they can customise/create that probably won’t work

I was able to do most of what I’m after with the resourceMapper as you mention @pemontto

I am now looking into validating dynamically loaded custom fields / providing default values for some of them.

I see this in the docs re: validation:

"Add validation rules to fields if possible. For example, check for valid email patterns if the field expects an email.

When displaying errors, make sure only the main error message displays in the red error title. More information should go in Details."

Does anyone know of where this is better documented or a node to look at for examples?


1 Like

Digging a bit deeper I see that validation is available for INodePropertyMode[], but not INodeProperties so only can provide value validation when using type: 'resourceLocator'.

If I want to provide value validation for fields that are of type INodeProperties do you recommend I extend this type?


Have a look at recently overhauled nodes - Pull requests · n8n-io/n8n · GitHub

The ones that spring to mind are Google Sheets and Postgres if you haven’t seen them already:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.