Describe the problem/error/question
I’m taking a course and the video doesn’t show all the code, and I’m almost done. Help please! (Code x Airtable)
The objective of this workflow is to delete the corresponding client from the Airtable table corresponding to the client who wants to cancel it, the code has to identify which one of those that arrive
The guy in the video forgets to show all the code
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
“nodes”: [
{
“parameters”: {
“jsCode”: “// Paso 1: Obtener los datos del cliente desde el nodo ‘Edit Fields’\nconst cliente = $(‘Edit Fields’).first().json;\n\nconst horaCliente = cliente.Hora?.trim();\nconst fechaCliente = cliente.Fecha?.trim();\nconst nombreCliente = cliente.Nombre?.trim().toLowerCase();\nconst telCliente = cliente.Telefono?.trim();\n\n// Paso 2: Obtener todos los registros de Airtable\nconst registros = $input.all();\n\n// Paso 3: Filtrar registros que coincidan con los 4 campos\nconst coincidencias = registros.filter(item => {\n const fields = item.json.fields || {};\n\n const hora = fields.Hora?.trim();\n const fecha = fields.Fecha?.trim();\n const nombre = fields.Nombre?.trim().toLowerCase();\n const tel = fields.Telefono?.trim();\n\n return (\n hora === horaCliente &&\n fecha === fechaCliente &&\n nombre === nombreCliente &&\n tel === telCliente\n );\n});\n\n// Paso 4: Devolver coincidencia o mensaje de error\nif (coincidencias.length === 0) {\n return [{\n json: {\n resultado: “No se encontró ninguna reserva con esos datos para cancelar.”\n }\n }];\n}\n\nreturn coincidencias;\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
64,
16
],
“id”: “7870137a-3cd4-46b7-8dd2-518a2263ddd2”,
“name”: “Code in JavaScript”
}
],
“connections”: {
“Code in JavaScript”: {
“main”: [
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “f60311e5337308d0f8c1efc4eb99285eaa09f21ca35ef2312c7c2dbb6e8d80b9”
}
}




