# Custom Node Dynamic Field Generation

**URL:** <https://community.n8n.io/t/custom-node-dynamic-field-generation/29013>\
**Category:** Questions\
**Tags:** development, custom-node\
**Created:** [August 6, 2023, 1:17am UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013 "2023-08-06T01:17:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryanflomenco](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ryanflomenco/32/28529_2.png) [@ryanflomenco](https://community.n8n.io/u/ryanflomenco)\
**Post date:** [August 6, 2023, 1:17am UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/1 "2023-08-06T01:17:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MutedJam](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/mutedjam/32/70851_2.png) [@MutedJam](https://community.n8n.io/u/MutedJam)\
**Post date:** [August 7, 2023, 1:38pm UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/3 "2023-08-07T13:38:03Z")

</div>

> [@ryanflomenco](#):
>
> I assume not

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

---

<div class="post-metadata">

**Author:** ![marcus](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/marcus/32/15989_2.png) [@marcus](https://community.n8n.io/u/marcus)\
**Post date:** [August 7, 2023, 2:56pm UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/5 "2023-08-07T14:56:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pemontto](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pemontto/32/2684_2.png) [@pemontto](https://community.n8n.io/u/pemontto)\
**Post date:** [August 7, 2023, 4:41pm UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/6 "2023-08-07T16:41:29Z")

</div>

If it’s just things like custom fields, you may be able to use the very new [Node UI elements | n8n Docs](https://docs.n8n.io/integrations/creating-nodes/build/reference/ui-elements/#resource-mapper)

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

---

<div class="post-metadata">

**Author:** ![ryanflomenco](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ryanflomenco/32/28529_2.png) [@ryanflomenco](https://community.n8n.io/u/ryanflomenco)\
**Post date:** [August 7, 2023, 6:06pm UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/7 "2023-08-07T18:06:29Z")

</div>

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![ryanflomenco](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ryanflomenco/32/28529_2.png) [@ryanflomenco](https://community.n8n.io/u/ryanflomenco)\
**Post date:** [August 7, 2023, 7:29pm UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/8 "2023-08-07T19:29:47Z")

</div>

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![pemontto](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/pemontto/32/2684_2.png) [@pemontto](https://community.n8n.io/u/pemontto)\
**Post date:** [August 8, 2023, 10:03am UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/9 "2023-08-08T10:03:38Z")

</div>

Have a look at recently overhauled nodes - [Pull requests · n8n-io/n8n · GitHub](https://github.com/n8n-io/n8n/pulls?q=is%3Apr+overhaul+is%3Aclosed)

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

- [https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/Google/Sheet/v2/methods/resourceMapping.ts](https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/Google/Sheet/v2/methods/resourceMapping.ts)
- [https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/Postgres/v2/methods/resourceMapping.ts](https://github.com/n8n-io/n8n/blob/master/packages/nodes-base/nodes/Postgres/v2/methods/resourceMapping.ts)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [November 6, 2023, 10:03am UTC](https://community.n8n.io/t/custom-node-dynamic-field-generation/29013/10 "2023-11-06T10:03:53Z")

</div>

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