How to fetch the key in getNodeParameter()?

Hi N8N team,
Question1:
In my dropdown, I am having name as runner_Name and value as corresponding id.

                        return_array.push({name:val['runner_Name'],value:val['runner_Id']})

I need both of this information. Using this.getNodeParameter() I can able to fetch only values(runner_id) , how to fetch the corresponding name here.
Question2:
While executing like this in that corresponding node the id is coming after changing the value in their dependent drop down(first drop down).
U can see in the second dropdown the id 29 is displaying instead of instance name after doing some changes in the first dropdown .How to solve this I don’t want the id to be displayed here


Question3:
How pass value from one method to another method?
Inside getVersion method I am using some APIS and getting response. If I want to send the particular response value(other than instance_id using getNodeParameter()) to my other method getDevice() how to fetch the value and do other operations.(in the response I will be having instance_name,external_url,date_created like that so how to use all the other values instead of calling the same apis again in another method)

Thanks and Regards,
Praveen

Hey @praveen,

That first question is a good one and I am not actually sure, The only thing I can think of would be to make the value an object and have the name and id in it so you can use them later. @marcus or @RicardoE105 may have another idea on that one.

With question 2 I assume you are using the value from the first box so at the moment I would say this is working as expected.

On the last part have you tried adding to the method parameters so something like getDevices(this: ILoadOptionsFunctions, instance_name: string, external_url: string, date_created: string)?

2 Likes

If you need both, then you need to set values to a JSON with the values you need.

return_array.push({name:val[‘runner_Name’],value: JSON.strintigy({ runner_id: val[‘runner_Id’], runner_name: val[“runner_name”] })})

Then to retrieve the data, you do:

const data = this.getNodeParameter("parameterName")

const jsonData = JSON.parse(data);

jsonData should then have. { runner_id: the id, runner_name: the name }
2 Likes