Get a value of a specific trello tag

Good night,
I’m not a programmer but I try to get the best out of n8n. I’m very happy with what I’ve achieved so far, but sometimes I get stuck on things that are perhaps easy and I can’t understand.

For now I need help with something that I have tried to do but have not succeeded. I need to know if the label “ENTREGA” comes on a trello card, the problem is that it can come together with others, therefore I cannot refer to the node number.

I’ve tried doing the following (based on other help I received on something similar), but to no avail.
I’m putting this in a function node:

item.etiqueta = item.labels.find(field => field.id == '60081df737fe772901150276').name;

return item;

this throws the following error: item is not defined [Line 1]

i tried making variations, however nothing works :frowning:

This is my json:

[
  {
    "labels": [
      {
        "id": "60081df737fe772901150264",
        "idBoard": "60081df737fe772901150244",
        "name": "ENVIO",
        "color": "green"
      },
      {
        "id": "60081df737fe772901150276",
        "idBoard": "60081df737fe772901150244",
        "name": "ENTREGA",
        "color": "orange"
      }
    ],
    "idLabels": [
      "60081df737fe772901150264",
      "60081df737fe772901150276"
    ],
  }
]

Any help is very welcome.
Thank you very much!

Hi @patomi, either declare etiqueta a a variable let etiqueta = item.labels.etc. and then Return etiqueta or directly return the expression, as follows:

return item.labels.find(field => field.id == '60081df737fe772901150276').name;

Here’s a sample workflow:

and a small improvement:

return {json: item.labels.find(field => field.id == '60081df737fe772901150276').name}

added {json: ... }

and alternative code if you’re using the Function instead of the Function Item Node:

return [{json:items[0].json.labels.find(field => field.id == '60081df737fe772901150276')}]
1 Like

Thank you very much, it worked perfectly.
It’s exciting to see what a great supportive community there is around n8n.
I greatly appreciate the support and invaluable help that they give us to the most novice and inexperienced like me.
Thank you very much!

1 Like