Really weird behavior on Set Node

Describe the problem/error/question

I have a Set node that I want to use it for change value with an JS expression. {{ $json.propertyValue = true ? ‘Verdadero’ : ‘Falso’ }}

But for some reason, the value in the node behind is changing whenever I write the expression.

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.109.2

  • Database (default: SQLite): Postgres SQL

  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker in Coolify

In the Set node you can’t use “=” because that assigns a value and ends up changing the JSON behind it. What you want is a conditional expression. Just write:

{{ $json.propertyValue ? ‘Verdadero’ : ‘Falso’ }}

This way it only reads the value and outputs either “Verdadero” or “Falso.” If you need more complex logic, use a Code node instead.

2 Likes

I think it’s fine, you’re just assigning a new value to the same field propertyValue using = which will directly take effect..
What behavior are you expecting?

Thanks you @Gallo_AIA! Code node is the way.

1 Like

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