N8N does not recognize the value of a field

Guys, I have a return that gives me a field, when I try to use it, it always returns “undefined” does anyone know why?
I understand that this field may or may not return the results, is that why? Since it’s not a field that always appears, I can’t use it?
The field with the error is the one from the last step:
{{ $json.customFields[1].enum_value.name }}

return data:

[
  {
    "gid": "1207315181354392",
    "assigneeGid": "1206361965322646",
    "completed_at": "2024-05-14T19:45:15.207Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": 4
      }
    ]
  },
  {
    "gid": "1207267839503506",
    "assigneeGid": "1206844449630586",
    "completed_at": "2024-05-14T17:54:39.180Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": 5
      }
    ]
  },
  {
    "gid": "1207304297011651",
    "assigneeGid": "1206841885830929",
    "completed_at": "2024-05-14T14:56:11.954Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": null
      },
      {
        "gid": "1207251090649455",
        "enum_value": {
          "gid": "1207251090649459",
          "color": "yellow-orange",
          "enabled": true,
          "name": "Médio",
          "resource_type": "enum_option"
        },
        "name": "Grau"
      }
    ]
  },
  {
    "gid": "1207304294815959",
    "assigneeGid": "1206841885830929",
    "completed_at": "2024-05-14T14:51:46.100Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": null
      },
      {
        "gid": "1207251090649455",
        "enum_value": {
          "gid": "1207251090649458",
          "color": "green",
          "enabled": true,
          "name": "Fácil",
          "resource_type": "enum_option"
        },
        "name": "Grau"
      }
    ]
  },
  {
    "gid": "1207304294815961",
    "assigneeGid": "1206841885830929",
    "completed_at": "2024-05-14T14:52:14.160Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": null
      },
      {
        "gid": "1207251090649455",
        "enum_value": {
          "gid": "1207251090649458",
          "color": "green",
          "enabled": true,
          "name": "Fácil",
          "resource_type": "enum_option"
        },
        "name": "Grau"
      }
    ]
  },
  {
    "gid": "1207304294815957",
    "assigneeGid": "1206362073473212",
    "completed_at": "2024-05-14T15:17:12.708Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": null
      },
      {
        "gid": "1207251090649455",
        "enum_value": {
          "gid": "1207251090649458",
          "color": "green",
          "enabled": true,
          "name": "Fácil",
          "resource_type": "enum_option"
        },
        "name": "Grau"
      }
    ]
  },
  {
    "gid": "1207304297011715",
    "assigneeGid": "1203886717633150",
    "completed_at": "2024-05-14T14:23:14.811Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": null
      },
      {
        "gid": "1207251090649455",
        "enum_value": {
          "gid": "1207251090649461",
          "color": "blue",
          "enabled": true,
          "name": "Colaboração",
          "resource_type": "enum_option"
        },
        "name": "Grau"
      }
    ]
  },
  {
    "gid": "1207286377217897",
    "assigneeGid": "1169940208997012",
    "completed_at": "2024-05-14T14:47:42.852Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": 0.1
      }
    ]
  },
  {
    "gid": "1207193514159264",
    "assigneeGid": "1169940208997012",
    "completed_at": "2024-05-14T14:40:03.453Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": 3
      }
    ]
  },
  {
    "gid": "1207308586171235",
    "assigneeGid": "1206361965322646",
    "completed_at": "2024-05-13T20:22:42.193Z",
    "customFields": [
      {
        "gid": "1204219176386539",
        "name": "Tempo de Execução (horas)",
        "number_value": 2
      }
    ]
  }
]

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @Pedro_Malaquias

it’s undefined because n8n will calculate it’s value from the first item. You can hover on the desired item to see if the expression becomes green.

1 Like