I am trying to create a node whose properties need to be dynamically displayed based on the results of an API call.
Currently the properties of a node are defined in a node statically like this
properties: [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
options: [
{
name: 'Find',
value: 'find',
description: 'Find documents.',
},
{
name: 'Insert',
value: 'insert',
description: 'Insert documents.',
},
{
name: 'Update',
value: 'update',
description: 'Updates documents.',
},
],
default: 'find',
description: 'The operation to perform.',
},
{
displayName: 'Database',
name: 'database',
type: 'string',
required: true,
default: '',
description: 'MongoDB Database to connect to'
},
{
displayName: 'Collection',
name: 'collection',
type: 'string',
required: true,
default: '',
description: 'MongoDB Collection'
},
]
Each of these properties is defined in advance and are static. Is there any way to load the properties dynamically? All of them? or some new ones after a previous property has been selected?
I know how to use the loadOptionsMethod
param within a property to get a list of possible values like this
typeOptions: {
loadOptionsMethod: 'getDatasources',
},
But in my use-case, I want to create the properties themselves.
Is there any existing way to do this? If not, what could be a simple approach to make this work. I am open to taking direction and then making changes in the core.