In a Set node, can I have a default?

Can I have a default value if the variable is emply?

I think this could look something like this:

{{ $('Halo Credentials').first().json["site_id"] OR Default Value.  }}

NA

NA

Information on your n8n setup

  • n8n version: 1.41.0
  • Database (default: SQLite): PostgresQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Queue
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker on DO
  • Operating system: Ubuntu 22.04

@russellkg , it actually looks like this

{{ $('Halo Credentials').first().json["site_id"] ? $('Halo Credentials').first().json["site_id"] : 'DEFAULT VALUE'  }}

The example assumes a string as a value. If it is a numeric value, you would need to remove the quotes around DEFAULT VALUE.

1 Like

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