I have this code in an expression in the Set node.
$node["Item Lists"].json["pledge"]["isRecurrent"] === 'false'
? $json["fields"]["Seznamy kontaktů"].push('recx2v1IUczJc7Fsv')
: $json["fields"]["Seznamy kontaktů"].push('recdzgujTppgs1vrE')
The Set node returns a length of the array instead of the array itself. Also, the number is increasing when interacting with the workflow. The original array has two items, I am adding a third one – the length is 88 and increasing.
Can you please suggest how to resolve this?
December 17, 2022, 5:03pm
push returns (which is the new length of the array it pushed to):
Here an example:
Here are the docs of push:
@jan – I was so sure this method returns the array, so I even did not check the docs. This is stupid, sorry and thanks!
December 17, 2022, 5:15pm
Ah and regarding the second part. How to do it. Normally you could do something like this:
[...$json["fields"]["Seznamy kontaktů"], 'recx2v1IUczJc7Fsv']
but honestly do not know right now why it does not work in n8n.
In this case probably best to use a Code-Node.
December 24, 2022, 5:16pm
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.