Problem with airtable update

Hello,

Here’s my problem. I try to uptade a row in Airtable with the row’s id.
1/ I list the records to get the id and all the data.
2/ If the name is “LE CORRE-HEURTIN” then…
3/ I change his numeroRPPS to 1
4/ I update only the numeroRPPS of this guy using his row’s id.

Here’s my workflow :

{
  "name": "airtable update",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        90,
        300
      ]
    },
    {
      "parameters": {
        "operation": "list",
        "application": "appl8VT0U5WSVMlQN",
        "table": "pharmaciens",
        "additionalOptions": {}
      },
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        260,
        300
      ],
      "credentials": {
        "airtableApi": "Airtable Credentials"
      }
    },
    {
      "parameters": {
        "operation": "update",
        "application": "={{$node[\"Airtable\"].parameter[\"application\"]}}",
        "table": "={{$node[\"Airtable\"].parameter[\"table\"]}}",
        "id": "={{$node[\"Function\"].json[\"id\"]}}",
        "updateAllFields": false,
        "fields": [
          "numeroRPPS"
        ],
        "options": {}
      },
      "name": "Airtable2",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        840,
        120
      ],
      "credentials": {
        "airtableApi": "Airtable Credentials"
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$node[\"Airtable\"].json[\"fields\"][\"nom\"]}}",
              "value2": "LE CORRE-HEURTIN"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        460,
        300
      ]
    },
    {
      "parameters": {},
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        650,
        400
      ]
    },
    {
      "parameters": {
        "functionCode": "items[0].json.myVariable = 1;\nitems[0].json.fields.numeroRPPS = 1;\n\nreturn items;"
      },
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        240
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Airtable": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "Function",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NoOp": {
      "main": [
        []
      ]
    },
    "Function": {
      "main": [
        [
          {
            "node": "Airtable2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "1009"
}

Unfortunately, the Airtable update node doesn’t send the right data. The numeroRPPS is not changed. What am i missing? Is there a more smoother and correct way to do that?

@StanMeister You need to change items[0].json.fields.numeroRPPS = 1 to items[0].json.numeroRPPS = 1

Also, you might want to replace the function node with a set node. Check the example below:

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "list",
        "application": "appl8VT0U5WSVMlQN",
        "table": "pharmaciens",
        "additionalOptions": {}
      },
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        540,
        330
      ],
      "credentials": {
        "airtableApi": "Airtable Credentials"
      }
    },
    {
      "parameters": {
        "operation": "update",
        "application": "={{$node[\"Airtable\"].parameter[\"application\"]}}",
        "table": "={{$node[\"Airtable\"].parameter[\"table\"]}}",
        "id": "={{$node[\"Function\"].json[\"id\"]}}",
        "updateAllFields": false,
        "fields": [
          "numeroRPPS"
        ],
        "options": {}
      },
      "name": "Airtable2",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        1120,
        150
      ],
      "credentials": {
        "airtableApi": "Airtable Credentials"
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$node[\"Airtable\"].json[\"fields\"][\"nom\"]}}",
              "value2": "LE CORRE-HEURTIN"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        740,
        330
      ]
    },
    {
      "parameters": {},
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        930,
        430
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [],
          "number": [
            {
              "name": "numeroRPPS",
              "value": 1
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        920,
        220
      ]
    }
  ],
  "connections": {
    "Airtable": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "Airtable2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

@RicardoE105 Well, i tried something with the set node but i still can’t update the value.

In the Airtable node, i need the row’s id wich i take from the if node (last node with this information since i use the “keep only set” in the set node).

And i’ve got this error :

ERROR: Airtable error response [INVALID_VALUE_FOR_COLUMN]: Field “numeroRPPS” cannot accept the provided value

Error: Airtable error response [INVALID_VALUE_FOR_COLUMN]: Field "numeroRPPS" cannot accept the provided value
    at Object.apiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Airtable/GenericFunctions.js:35:23)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Airtable/Airtable.node.js:516:32)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:395:47

Here’s my workflow :

{
  "name": "airtable update - ricardo",
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        60,
        130
      ]
    },
    {
      "parameters": {
        "operation": "list",
        "application": "appl8VT0U5WSVMlQN",
        "table": "pharmaciens",
        "additionalOptions": {}
      },
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        250,
        140
      ],
      "credentials": {
        "airtableApi": "Airtable Credentials"
      }
    },
    {
      "parameters": {
        "operation": "update",
        "application": "={{$node[\"Airtable\"].parameter[\"application\"]}}",
        "table": "={{$node[\"Airtable\"].parameter[\"table\"]}}",
        "id": "={{$node[\"IF\"].json[\"id\"]}}",
        "updateAllFields": false,
        "fields": [
          "numeroRPPS"
        ],
        "options": {}
      },
      "name": "Airtable2",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 1,
      "position": [
        900,
        10
      ],
      "credentials": {
        "airtableApi": "Airtable Credentials"
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$node[\"Airtable\"].json[\"fields\"][\"nom\"]}}",
              "value2": "LE CORRE-HEURTIN"
            }
          ]
        }
      },
      "name": "IF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        440,
        130
      ]
    },
    {
      "parameters": {},
      "name": "NoOp",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        690,
        220
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [],
          "number": [
            {
              "name": "numeroRPPS",
              "value": 11111111111
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        670,
        0
      ]
    }
  ],
  "connections": {
    "Airtable": {
      "main": [
        [
          {
            "node": "IF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NoOp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "Airtable2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {},
  "id": "1010"
}

I don’t understand this message because the value format is good (11 numbers).

Can you share a picture of the output of the set node? Also what type is the field numeroRPPS in airtable?

Set node result :

Set node result with the “keep only set” :

The field type in Airtable is “single line text”. This is the default type when adding data via CSV.

ahh then that is the issue. You can use string in the set node or change the field type in Airtable to number.

Indeed. No more error. But still, the numeroRPPS has not changed.

pb update3 airtable

I’m wondering if the process send the right information because here is the result of the update node :

There’s no trace of the “numeroRPPS” = “11111111111” defined in the set node.

I just checked, it seems the API call to update records changed. I’m investigating. I will keep you updated.

@StanMeister got fixed. We will let you know when is released.

Thank you very much. :slight_smile:

Got released with [email protected]

1 Like