I’m currently working on a declarative style custom node and I want to load the options of a property dynamical:
properties: [
{
displayName: 'Team ID',
name: 'teamId',
type: 'options',
default: {},
placeholder: 'Ninox Team (67mm9vc324bM7x)',
required: true,
description: 'The ID of the team to access',
typeOptions: {
loadOptions: {
routing: {
request: {
method: 'GET',
url: 'teams',
},
output: {
postReceive: [
{
type: 'setKeyValue',
properties: {
name: '={{$responseItem.name}} ({{$responseItem.id}})',
value: '={{$responseItem.id}}',
},
},
{
type: 'sort',
properties: {
key: 'name',
},
},
],
},
},
},
},
}
]
Expected Behavior:
I get the queried options which should changed trough output.postReceive to something like " Team (TeamID) ".
Observed Behavior:
What I get instead is: " ()". It feels like the API result is not getting trough postReceive. (Or I’m using the wrong variables??)
Somehow when I remove output.postReceive I get the expected options, but can’t use them because I cannot map the result properly, so the values of the options are the $responseItem.id.
I’m sure I don’t need to use the rootProperty output pipe, 'cuz the API I’m querying response is just an array llike: [{ "id": "67mm9vc324bM7x", "name": "Test Team" }]
Has anyone an idea? Would love to provide an dropdown instead of a text input.
Repo
Information on your n8n setup
- n8n version: 0.192.2
- Database you’re using: SQLite
- Running n8n with the execution process: own
- Running n8n via: npm