Describe the problem/error/question
I have this workflow where it’s working everything right when I executed manually, but whenever it comes from the schedule trigger, it gets stuck in the last node that inserts the information in a Postgres DB. I can’t find the difference between both executions, cause the information retrieved is the same, the only difference is the way it started the execution.
What is the error message (if any)?
ERROR: Invalid input for ‘date_submitted’ [item 0]
‘date_submitted’ expects a dateTime but we got ‘2023/03/14’.
Consider using DateTime.fromFormat
to work with custom date formats.
ExpressionError: Invalid input for 'date_submitted' [item 0]
at validateValueAgainstSchema (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1272:15)
at getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1310:18)
at Object.getNodeParameter (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1515:24)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/actions/database/insert.operation.js:163:29)
at Object.router (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Postgres/v2/actions/router.js:48:81)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:652:28)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:53
Please share your workflow
{
"meta": {
"instanceId": "009c47e16935f242678b66eb03617015d002e35674e88e485216029df7bb4682"
},
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 15,
"triggerAtMinute": 44
}
]
}
},
"id": "7e34c302-725a-44e0-8990-5b75d8a30469",
"name": "Schedule Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.1,
"position": [
80,
280
]
},
{
"parameters": {
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1YrQwYN7k6rowM3aKUfLDInAZLT8SSgFd3GVDk6Klwzs/edit#gid=0",
"mode": "url",
"__regex": "https:\\/\\/(?:drive|docs)\\.google\\.com(?:\\/.*|)\\/d\\/([0-9a-zA-Z\\-_]+)(?:\\/.*|)"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Results",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YrQwYN7k6rowM3aKUfLDInAZLT8SSgFd3GVDk6Klwzs/edit#gid=0"
},
"options": {}
},
"id": "be0e321e-02f7-4036-9cc3-c525c6ed9c14",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4,
"position": [
380,
280
],
"credentials": {
"googleSheetsOAuth2Api": {
"id": "34",
"name": "Sheets NS"
}
}
},
{
"parameters": {
"jsCode": "const inputJson = $input.all();\n// console.log(inputJson);\n\n// Crear una matriz para almacenar los resultados\nconst results = [];\n\n// Recorrer cada objeto en el JSON de entrada\nfor (const item of inputJson) {\n // Extraer los valores dentro de la propiedad \"data\"\n const dataValues = item.json;\n\n console.log(dataValues);\n\n const dateString = dataValues.date_submitted;\n const dateParts = dateString.split(\" \"); // Divide la fecha y la hora\n const dateComponents = dateParts[0].split(\"/\"); // Divide el día, mes y año\n const timeComponents = dateParts[1].split(\":\"); // Divide la hora, minutos y segundos\n\n // console.log('timeComponents');\n // console.log(timeComponents);\n \n // Crear un objeto Date\n const formattedDate = new Date(\n parseInt(dateComponents[2]), // Año\n parseInt(dateComponents[1]) - 1, // Mes (restar 1 ya que en JavaScript los meses van de 0 a 11)\n parseInt(dateComponents[0]), // Día\n parseInt(timeComponents[0]), // Hora\n parseInt(timeComponents[1]), // Minutos\n parseInt(timeComponents[2]) // Segundos\n );\n \n // Crear un objeto para almacenar los valores de esta entrada\n const row = {\n company_name_input: dataValues.company_name_input || null,\n company_position: dataValues.company_position || null,\n satisfaction_product_quality: parseInt(dataValues.satisfaction_product_quality) || 0,\n satisfaction_due_time: parseInt(dataValues.satisfaction_due_time) || 0,\n product_errors: dataValues.product_errors || null,\n product_meet_expectations: dataValues.product_meet_expectations || null,\n team_communication: parseInt(dataValues.team_communication) || 0,\n team_quick_response: parseInt(dataValues.team_quick_response) || 0,\n direct_communication: dataValues.direct_communication || false,\n team_resolution_capacity: parseInt(dataValues.team_resolution_capacity) || 0,\n team_expertise_level: parseInt(dataValues.team_expertise_level) || 0,\n team_training_capacity: dataValues.team_training_capacity || null,\n nps: dataValues.nps || null,\n date_submitted: formattedDate, \n id: dataValues.row_number,\n month_analysis: dataValues.month_analysis,\n year_analysis: dataValues.year_analysis,\n company_name_db: dataValues.company_name_db,\n communication_escalation: dataValues.communication_escalation,\n partner_referral: dataValues.partner_referral,\n key_user_known: dataValues.key_user_known,\n decision_maker_known: dataValues.decision_maker_known,\n csm_sentiment: dataValues.csm_sentiment\n };\n\n // Agregar la fila al resultado\n results.push(row);\n}\n\n// Log the results\nconsole.log(results);\n\n// Output los resultados (debes ajustar esto a cómo N8n maneja la salida)\nreturn results;\n"
},
"id": "2694de65-5b9f-4f48-9fc8-0488840acc2b",
"name": "Code",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
800,
260
]
},
{
"parameters": {
"operation": "deleteTable",
"schema": {
"__rl": true,
"value": "customer_success",
"mode": "list",
"cachedResultName": "customer_success"
},
"table": {
"__rl": true,
"value": "form_responses",
"mode": "list",
"cachedResultName": "form_responses"
},
"restartSequences": true,
"options": {}
},
"id": "24102215-2d35-4a48-874d-13f08a12839e",
"name": "Postgres1",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
480,
520
],
"credentials": {
"postgres": {
"id": "50",
"name": "Postgres BG local"
}
}
},
{
"parameters": {
"schema": {
"__rl": true,
"value": "customer_success",
"mode": "list",
"cachedResultName": "customer_success"
},
"table": {
"__rl": true,
"value": "form_responses",
"mode": "list",
"cachedResultName": "form_responses"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"direct_communication": "={{ $json.direct_communication }}",
"id": "={{ $json.id }}",
"company_name_input": "={{ $json.company_name_input }}",
"company_position": "={{ $json.company_position }}",
"satisfaction_product_quality": "={{ $json.satisfaction_product_quality }}",
"satisfaction_due_time": "={{ $json.satisfaction_due_time }}",
"product_errors": "={{ $json.product_errors }}",
"product_meet_expectations": "={{ $json.product_meet_expectations }}",
"team_communication": "={{ $json.team_communication }}",
"team_quick_response": "={{ $json.team_quick_response }}",
"team_resolution_capacity": "={{ $json.team_resolution_capacity }}",
"team_expertise_level": "={{ $json.team_expertise_level }}",
"team_training_capacity": "={{ $json.team_training_capacity }}",
"nps": "={{ $json.nps }}",
"date_submitted": "={{ $json.date_submittedv2 }}",
"month_analysis": "={{ $json.month_analysis }}",
"company_name_db": "={{ $json.company_name_db }}",
"year_analysis": "={{ $json.year_analysis }}",
"communication_escalation": "={{ $json.communication_escalation }}",
"partner_referral": "={{ $json.partner_referral }}",
"key_user_known": "={{ $json.key_user_known }}",
"decision_maker_known": "={{ $json.decision_maker_known }}",
"csm_sentiment": "={{ $json.csm_sentiment }}"
},
"matchingColumns": [
"id"
],
"schema": [
{
"id": "company_name_input",
"displayName": "company_name_input",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "company_name_db",
"displayName": "company_name_db",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "company_position",
"displayName": "company_position",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "satisfaction_product_quality",
"displayName": "satisfaction_product_quality",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "satisfaction_due_time",
"displayName": "satisfaction_due_time",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "product_errors",
"displayName": "product_errors",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "product_meet_expectations",
"displayName": "product_meet_expectations",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true
},
{
"id": "team_communication",
"displayName": "team_communication",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "team_quick_response",
"displayName": "team_quick_response",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "direct_communication",
"displayName": "direct_communication",
"required": false,
"defaultMatch": false,
"display": true,
"type": "boolean",
"canBeUsedToMatch": true
},
{
"id": "team_resolution_capacity",
"displayName": "team_resolution_capacity",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "team_expertise_level",
"displayName": "team_expertise_level",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "team_training_capacity",
"displayName": "team_training_capacity",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "nps",
"displayName": "nps",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true
},
{
"id": "date_submitted",
"displayName": "date_submitted",
"required": false,
"defaultMatch": false,
"display": true,
"type": "dateTime",
"canBeUsedToMatch": true
},
{
"id": "id",
"displayName": "id",
"required": false,
"defaultMatch": true,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "month_analysis",
"displayName": "month_analysis",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "year_analysis",
"displayName": "year_analysis",
"required": false,
"defaultMatch": false,
"display": true,
"type": "number",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "communication_escalation",
"displayName": "communication_escalation",
"required": false,
"defaultMatch": false,
"display": true,
"type": "boolean",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "partner_referral",
"displayName": "partner_referral",
"required": false,
"defaultMatch": false,
"display": true,
"type": "boolean",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "key_user_known",
"displayName": "key_user_known",
"required": false,
"defaultMatch": false,
"display": true,
"type": "boolean",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "decision_maker_known",
"displayName": "decision_maker_known",
"required": false,
"defaultMatch": false,
"display": true,
"type": "boolean",
"canBeUsedToMatch": true,
"removed": false
},
{
"id": "csm_sentiment",
"displayName": "csm_sentiment",
"required": false,
"defaultMatch": false,
"display": true,
"type": "string",
"canBeUsedToMatch": true,
"removed": false
}
]
},
"options": {}
},
"id": "7436eddf-f705-4a92-b9b9-f047f58718ee",
"name": "Reinsert Full Delete",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
1340,
520
],
"credentials": {
"postgres": {
"id": "50",
"name": "Postgres BG local"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.company_name_input }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "3a84edf6-82b5-48a9-a06d-8adcb15eacc9",
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
600,
280
]
},
{
"parameters": {
"operation": "formatDate",
"date": "={{ $json[\"date_submitted\"] }}",
"format": "yyyy/MM/dd",
"outputFieldName": "date_submittedv2",
"options": {}
},
"id": "ad727d7a-cb9e-4e1e-82a1-9d6cf06bfffc",
"name": "Date & Time",
"type": "n8n-nodes-base.dateTime",
"typeVersion": 2,
"position": [
980,
60
]
},
{
"parameters": {
"mode": "combine",
"combinationMode": "mergeByPosition",
"options": {}
},
"id": "555a0497-0b8e-49fa-8389-5daba99467a5",
"name": "Merge1",
"type": "n8n-nodes-base.merge",
"typeVersion": 2.1,
"position": [
1160,
240
]
},
{
"parameters": {},
"id": "4bfd656d-4815-466b-8de7-58ee5317aaaa",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
800,
420
]
}
],
"connections": {
"Schedule Trigger": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
},
{
"node": "Postgres1",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Date & Time",
"type": "main",
"index": 0
},
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
},
"Postgres1": {
"main": [
[
{
"node": "Reinsert Full Delete",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"Date & Time": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "Reinsert Full Delete",
"type": "main",
"index": 0
}
]
]
}
}
}```
## Share the output returned by the last node
[
{
"date_submittedv2":
"2023/03/14",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con varios errores",
"product_meet_expectations":
"No alcanzaba las expectativas",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-14T20:20:53.000Z",
"id":
2,
"month_analysis":
"Febrero",
"year_analysis":
2023,
"company_name_db":
"XX",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/15",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con varios errores",
"product_meet_expectations":
"Estaba en línea",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-15T18:12:15.000Z",
"id":
3,
"month_analysis":
"Febrero",
"year_analysis":
2023,
"company_name_db":
"XX",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/15",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con varios errores",
"product_meet_expectations":
"No alcanzaba las expectativas",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-15T19:10:33.000Z",
"id":
4,
"month_analysis":
"Febrero",
"year_analysis":
2023,
"company_name_db":
"XX",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/15",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con mínimos errores",
"product_meet_expectations":
"Estaba en línea",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-15T19:41:07.000Z",
"id":
5,
"month_analysis":
"Febrero",
"year_analysis":
2023,
"company_name_db":
"X",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/20",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con varios errores",
"product_meet_expectations":
"Estaba en línea",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-20T18:20:58.000Z",
"id":
6,
"month_analysis":
"Marzo",
"year_analysis":
2023,
"company_name_db":
"XX",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/21",
"company_name_input":
"XX",
"company_position":
null,
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con varios errores",
"product_meet_expectations":
"Estaba en línea",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-21T18:40:25.000Z",
"id":
7,
"month_analysis":
"Marzo",
"year_analysis":
2023,
"company_name_db":
"X",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/22",
"company_name_input":
"X",
"company_position":
"X",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con mínimos errores",
"product_meet_expectations":
"Estaba en línea",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-22T18:27:32.000Z",
"id":
8,
"month_analysis":
"Marzo",
"year_analysis":
2023,
"company_name_db":
"X",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/23",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con varios errores",
"product_meet_expectations":
"No alcanzaba las expectativas",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-23T16:39:17.000Z",
"id":
9,
"month_analysis":
"Marzo",
"year_analysis":
2023,
"company_name_db":
"X",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/23",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"No contaba con ningún error",
"product_meet_expectations":
"Estaba en línea",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-23T17:14:03.000Z",
"id":
10,
"month_analysis":
"Marzo",
"year_analysis":
2023,
"company_name_db":
"X",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
},
{
"date_submittedv2":
"2023/03/23",
"company_name_input":
"XX",
"company_position":
"XX",
"satisfaction_product_quality":
0,
"satisfaction_due_time":
0,
"product_errors":
"Contaba con mínimos errores",
"product_meet_expectations":
"Estaba en línea",
"team_communication":
0,
"team_quick_response":
0,
"direct_communication":
true,
"team_resolution_capacity":
0,
"team_expertise_level":
0,
"team_training_capacity":
0,
"nps":
0,
"date_submitted":
"2023-03-23T19:51:30.000Z",
"id":
11,
"month_analysis":
"Marzo",
"year_analysis":
2023,
"company_name_db":
"XXX",
"communication_escalation":
false,
"partner_referral":
false,
"key_user_known":
false,
"decision_maker_known":
false,
"csm_sentiment":
""
}
]
## Information on your n8n setup
- **n8n version:0.235.0**
That's all I know. Thank you very much for all the help!