{ "name": "Save User Registration to Airtable", "tags": [ { "id": "Fcqhqfi5hGHHR7nn", "name": "UserData", "createdAt": "2025-03-17T13:06:42.859Z", "updatedAt": "2025-03-17T13:06:42.859Z" }, { "id": "uScnF9NzR3PLIyvU", "name": "Published", "createdAt": "2025-03-21T07:22:28.491Z", "updatedAt": "2025-03-21T07:22:28.491Z" } ], "nodes": [ { "id": "fef66f10-a3eb-4e71-9493-3d90ebd52fde", "name": "On form submission", "type": "n8n-nodes-base.formTrigger", "notes": "Create User Form", "position": [ 120, 80 ], "parameters": { "options": { "path": "user-registration" }, "formTitle": "Create User", "formFields": { "values": [ { "fieldLabel": "Name", "placeholder": "Enter Your Name", "requiredField": true }, { "fieldType": "number", "fieldLabel": "Age", "placeholder": "Enter Your Age", "requiredField": true }, { "fieldType": "email", "fieldLabel": "email", "placeholder": "Enter Your Email", "requiredField": true }, { "fieldLabel": "address", "placeholder": "Enter Your Address" }, { "fieldType": "dropdown", "fieldLabel": "You have Subscription ?", "fieldOptions": { "values": [ { "option": "Yes" }, { "option": "No" } ] }, "requiredField": true } ] }, "formDescription": "Provide the necessary information here" }, "notesInFlow": true, "typeVersion": 2.2 }, { "id": "save-user-registration-to-airtable-prepare", "name": "Prepare registration", "type": "n8n-nodes-base.code", "typeVersion": 2, "parameters": { "mode": "runOnceForEachItem", "jsCode": "function main({body,submitted}) {\n if(!body||typeof body.Name!=='string'||!body.Name.trim()||typeof body.Age!=='number'||!Number.isFinite(body.Age)||typeof body.email!=='string'||!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(body.email)||!['Yes','No'].includes(body['You have Subscription ?'])||(body.address!=null&&typeof body.address!=='string'))throw Error('Provide name, numeric age, email and Yes/No subscription');\n const date=submitted??new Date().toISOString();\n if(typeof date!=='string'||!date)throw Error('Missing submission time');\n const fields={Name:body.Name,Age:String(body.Age),Email:body.email,Address:body.address??'',Subscription:body['You have Subscription ?'],Submitted:date};\n return {fields,records:[{fields}]};\n}\n\nreturn {json:main({body:$json,submitted:$json.submittedAt})};" } }, { "id": "1745c697-93ca-4374-8d1e-92e047ad7339", "name": "User Data Storage", "type": "n8n-nodes-base.airtable", "notes": "Store User Data", "position": [ 380, 80 ], "parameters": { "base": { "__rl": true, "mode": "id", "value": "YOUR_AIRTABLE_BASE_ID" }, "table": { "__rl": true, "mode": "id", "value": "YOUR_AIRTABLE_TABLE_ID" }, "columns": { "value": { "Age": "={{ $json.fields[\"Age\"] }}", "Name": "={{ $json.fields[\"Name\"] }}", "Email": "={{ $json.fields[\"Email\"] }}", "Address": "={{ $json.fields[\"Address\"] }}", "Submitted": "={{ $json.fields[\"Submitted\"] }}", "Subscription": "={{ $json.fields[\"Subscription\"] }}" }, "schema": [ { "id": "Name", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Name", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Age", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Age", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Email", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Email", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Address", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Address", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Subscription", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Subscription", "defaultMatch": false, "canBeUsedToMatch": true }, { "id": "Submitted", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Submitted", "defaultMatch": false, "canBeUsedToMatch": true } ], "mappingMode": "defineBelow", "matchingColumns": [] }, "options": {}, "operation": "create" }, "notesInFlow": true, "typeVersion": 2.1 } ], "active": false, "pinData": {}, "settings": { "executionOrder": "v1" }, "connections": { "On form submission": { "main": [ [ { "node": "Prepare registration", "type": "main", "index": 0 } ] ] }, "Prepare registration": { "main": [ [ { "node": "User Data Storage", "type": "main", "index": 0 } ] ] } } }