Hello,
When getting the data from a Trello custom field the name changes [“customFieldItems”][0-10] based on the other custom fields with data or no data within the card.
This has been really hard for me to identify specific fields because when I change, enter or erase the data on any field, the item number changes on the output I receive on n8n.
How can I get each custom field value regardless if the field number changes?
These are the field that change.
This is my workflow
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
-10,
110
],
"disabled": true
},
{
"parameters": {
"operation": "getAll",
"limit": 1,
"options": {
"search": "={{$node[\"Set\"].json[\"Email\"]}}"
}
},
"name": "Buscar el contacto",
"type": "n8n-nodes-base.mautic",
"typeVersion": 1,
"position": [
1190,
-90
],
"credentials": {
"mauticApi": "Mautic Login n8n"
}
},
{
"parameters": {
"resource": "campaignContact",
"contactId": "={{$node[\"Buscar el contacto\"].json[\"fields\"][\"all\"][\"id\"]}}",
"campaignId": "=79"
},
"name": "Agregar a retoques",
"type": "n8n-nodes-base.mautic",
"typeVersion": 1,
"position": [
1350,
-90
],
"credentials": {
"mauticApi": "Mautic Login n8n"
}
},
{
"parameters": {
"id": "5bec206ceec21d055b590279"
},
"name": "Mover a retoques",
"type": "n8n-nodes-base.trelloTrigger",
"typeVersion": 1,
"position": [
150,
110
],
"webhookId": "45ca3332-1718-4fbe-9a3e-078d6f772f8a",
"credentials": {
"trelloApi": "Trello GDP"
}
},
{
"parameters": {
"operation": "get",
"id": "={{$node[\"Mover a retoques\"].json[\"action\"][\"data\"][\"card\"][\"id\"]}}",
"additionalFields": {
"fields": "all",
"customFieldItems": true
}
},
"name": "Buscar tarjeta",
"type": "n8n-nodes-base.trello",
"typeVersion": 1,
"position": [
590,
10
],
"credentials": {
"trelloApi": "Trello GDP"
}
},
{
"parameters": {
"conditions": {
"boolean": [],
"string": [
{
"value1": "={{$node[\"Set\"].json[\"Lista Anterior\"]}}",
"operation": "notEqual",
"value2": "={{$node[\"Set\"].json[\"Lista Después\"]}}"
},
{
"value1": "={{$node[\"Set\"].json[\"Retoque\"]}}",
"value2": "true"
},
{
"value1": "={{$node[\"Set\"].json[\"Lista Anterior\"]}}",
"operation": "notEqual",
"value2": "Retoque"
}
]
}
},
"name": "Solo a Retoques",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1000,
10
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "Retoque",
"value": "={{ $json[\"customFieldItems\"][10] ? $json[\"customFieldItems\"][10][\"idCustomField\"] : 'not found' }}\n\n{{Object.values($node[\"Buscar tarjeta\"].json[\"customFieldItems\"][10][\"value\"]).join(', ')}}\n\n{{$json[\"customFieldItems\"][10][\"idCustomField\"]}}\n{{$json[\"customFieldItems\"][10][\"id\"]}}\n{{$json[\"customFieldItems\"][10][\"modelType\"]}}"
},
{
"name": "Lista Anterior",
"value": "={{$node[\"Mover a retoques\"].json[\"action\"][\"data\"][\"listBefore\"][\"name\"]}}"
},
{
"name": "Lista Después",
"value": "={{$node[\"Mover a retoques\"].json[\"action\"][\"data\"][\"listAfter\"][\"name\"]}}"
},
{
"name": "Email",
"value": "={{$node[\"Buscar tarjeta\"].json[\"customFieldItems\"][10][\"value\"][\"text\"]}}"
},
{
"name": "Album",
"value": "={{$node[\"Buscar tarjeta\"].json[\"customFieldItems\"][5][\"value\"][\"text\"]}}"
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
790,
10
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{Object.values($node[\"Mover a retoques\"].json[\"action\"][\"data\"][\"customFieldItem\"][\"value\"]).join(', ')}}",
"value2": "true"
},
{
"value1": "={{$node[\"Mover a retoques\"].json[\"action\"][\"data\"][\"customFieldItem\"][\"idCustomField\"]}}",
"value2": "5c818e0bf288db82b847c59e"
}
]
}
},
"name": "Retoque Check",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
330,
110
]
}
],
"connections": {
"Buscar el contacto": {
"main": [
[
{
"node": "Agregar a retoques",
"type": "main",
"index": 0
}
]
]
},
"Mover a retoques": {
"main": [
[
{
"node": "Retoque Check",
"type": "main",
"index": 0
}
]
]
},
"Buscar tarjeta": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"Solo a Retoques": {
"main": [
[
{
"node": "Buscar el contacto",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "Solo a Retoques",
"type": "main",
"index": 0
}
]
]
},
"Retoque Check": {
"main": [
[
{
"node": "Buscar tarjeta",
"type": "main",
"index": 0
}
]
]
}
}
}
}```