Value doesn't fill all the items

I am working on a flow with a goal to upload the attachments in a Zendesk ticket through an API call.
For this i need a token and a ticket id, but when i set the item with the “Set Node”, it fill only the first item (screenshot)


Do you know why guys?
thanks

Hey @Gabriele_Bracciali,

It is hard to say without seeing the incoming data or what is being put into the set node, My first thought is maybe there is no ticket ID for the second item.

Hi @Jon , thanks for replying.
I receive the TicketID by the creation of the issue on Zendesk, and the output is 1 item with all the data including the TicketID, Later i am using a Set node for create the output with the token and id (screen above)


Let me know if you need an example code.

Hey @Gabriele_Bracciali,

It would be useful to see the input items on the Set node and what the expression is.

Json to pin in the first node “Zendesk test”

[
  {
    "url": "tedst",
    "id": 3258946,
    "external_id": null,
    "via": {
      "channel": "api",
      "source": {
        "from": {},
        "to": {},
        "rel": null
      }
    },
    "created_at": "2022-11-01T11:32:02Z",
    "updated_at": "2022-11-01T11:32:02Z",
    "type": null,
    "subject": "summary test n8n",
    "raw_subject": "summary test n8n",
    "description": "descs",
    "priority": "normal",
    "status": "new",
    "recipient": null,
    "requester_id": 373893941859,
    "submitter_id": 373893941859,
    "assignee_id": null,
    "organization_id": 376842946799,
    "group_id": null,
    "collaborator_ids": [],
    "follower_ids": [],
    "email_cc_ids": [],
    "forum_topic_id": null,
    "problem_id": null,
    "has_incidents": false,
    "is_public": true,
    "due_at": null,
    "tags": [
      "account_validated",
      "es",
      "free",
      "self-service",
      "xxxx",
      "yes",
      "zendesk"
    ],
    "custom_fields": [
      {
        "id": 360017500160,
        "value": null
      },
      {
        "id": 360017500420,
        "value": null
      },
      {
        "id": 360020141060,
        "value": null
      },
      {
        "id": 360005819140,
        "value": null
      },
      {
        "id": 8265339770898,
        "value": "Task"
      },
      {
        "id": 8265365265170,
        "value": "descs"
      },
      {
        "id": 8265310084882,
        "value": "SB-SOXINT"
      },
      {
        "id": 8298363245586,
        "value": "SBX-21"
      },
      {
        "id": 4415184857618,
        "value": false
      },
      {
        "id": 7666659204626,
        "value": false
      },
      {
        "id": 8265364252434,
        "value": "CPS"
      },
      {
        "id": 5969010600210,
        "value": null
      },
      {
        "id": 8265364913170,
        "value": "Low"
      },
      {
        "id": 5968918272786,
        "value": null
      },
      {
        "id": 360017500440,
        "value": null
      },
      {
        "id": 360017612319,
        "value": null
      },
      {
        "id": 360009254440,
        "value": null
      },
      {
        "id": 360017613099,
        "value": null
      },
      {
        "id": 360017611839,
        "value": null
      },
      {
        "id": 360017611859,
        "value": null
      },
      {
        "id": 360000051290,
        "value": null
      },
      {
        "id": 360017500000,
        "value": null
      },
      {
        "id": 360014218340,
        "value": null
      },
      {
        "id": 360017611879,
        "value": null
      },
      {
        "id": 360000051310,
        "value": null
      },
      {
        "id": 360017588599,
        "value": null
      },
      {
        "id": 360002901880,
        "value": null
      },
      {
        "id": 360020245880,
        "value": null
      },
      {
        "id": 360019780219,
        "value": "free"
      },
      {
        "id": 360014799739,
        "value": null
      },
      {
        "id": 7666668214418,
        "value": null
      },
      {
        "id": 4655643113106,
        "value": null
      },
      {
        "id": 8265309051026,
        "value": "12415"
      },
      {
        "id": 7556414935954,
        "value": null
      },
      {
        "id": 7398744110994,
        "value": null
      },
      {
        "id": 4415179125138,
        "value": null
      },
      {
        "id": 360021206420,
        "value": false
      },
      {
        "id": 360017500320,
        "value": null
      },
      {
        "id": 360015006639,
        "value": null
      },
      {
        "id": 360012611760,
        "value": "xxxx"
      },
      {
        "id": 360017500340,
        "value": null
      },
      {
        "id": 360022884280,
        "value": null
      },
      {
        "id": 26653115,
        "value": null
      },
      {
        "id": 360017588159,
        "value": null
      },
      {
        "id": 360020633540,
        "value": null
      },
      {
        "id": 360017500360,
        "value": null
      },
      {
        "id": 360020141000,
        "value": null
      },
      {
        "id": 360014970840,
        "value": null
      },
      {
        "id": 360020219099,
        "value": null
      },
      {
        "id": 360017500380,
        "value": null
      },
      {
        "id": 360020141020,
        "value": null
      },
      {
        "id": 360013773540,
        "value": "yes"
      },
      {
        "id": 360017612779,
        "value": null
      },
      {
        "id": 360017500400,
        "value": null
      },
      {
        "id": 360020141040,
        "value": null
      },
      {
        "id": 360003547379,
        "value": null
      }
    ],
    "satisfaction_rating": {
      "score": "unoffered"
    },
    "sharing_agreement_ids": [],
    "custom_status_id": 2263399,
    "fields": [
      {
        "id": 360017500160,
        "value": null
      },
      {
        "id": 360017500420,
        "value": null
      },
      {
        "id": 360020141060,
        "value": null
      },
      {
        "id": 360005819140,
        "value": null
      },
      {
        "id": 8265339770898,
        "value": "Task"
      },
      {
        "id": 8265365265170,
        "value": "descs"
      },
      {
        "id": 8265310084882,
        "value": "SB-SOXINT"
      },
      {
        "id": 8298363245586,
        "value": "SBX-21"
      },
      {
        "id": 4415184857618,
        "value": false
      },
      {
        "id": 7666659204626,
        "value": false
      },
      {
        "id": 8265364252434,
        "value": "CPS"
      },
      {
        "id": 5969010600210,
        "value": null
      },
      {
        "id": 8265364913170,
        "value": "Low"
      },
      {
        "id": 5968918272786,
        "value": null
      },
      {
        "id": 360017500440,
        "value": null
      },
      {
        "id": 360017612319,
        "value": null
      },
      {
        "id": 360009254440,
        "value": null
      },
      {
        "id": 360017613099,
        "value": null
      },
      {
        "id": 360017611839,
        "value": null
      },
      {
        "id": 360017611859,
        "value": null
      },
      {
        "id": 360000051290,
        "value": null
      },
      {
        "id": 360017500000,
        "value": null
      },
      {
        "id": 360014218340,
        "value": null
      },
      {
        "id": 360017611879,
        "value": null
      },
      {
        "id": 360000051310,
        "value": null
      },
      {
        "id": 360017588599,
        "value": null
      },
      {
        "id": 360002901880,
        "value": null
      },
      {
        "id": 360020245880,
        "value": null
      },
      {
        "id": 360019780219,
        "value": "free"
      },
      {
        "id": 360014799739,
        "value": null
      },
      {
        "id": 7666668214418,
        "value": null
      },
      {
        "id": 4655643113106,
        "value": null
      },
      {
        "id": 8265309051026,
        "value": "12415"
      },
      {
        "id": 7556414935954,
        "value": null
      },
      {
        "id": 7398744110994,
        "value": null
      },
      {
        "id": 4415179125138,
        "value": null
      },
      {
        "id": 360021206420,
        "value": false
      },
      {
        "id": 360017500320,
        "value": null
      },
      {
        "id": 360015006639,
        "value": null
      },
      {
        "id": 360012611760,
        "value": "xxxx"
      },
      {
        "id": 360017500340,
        "value": null
      },
      {
        "id": 360022884280,
        "value": null
      },
      {
        "id": 26653115,
        "value": null
      },
      {
        "id": 360017588159,
        "value": null
      },
      {
        "id": 360020633540,
        "value": null
      },
      {
        "id": 360017500360,
        "value": null
      },
      {
        "id": 360020141000,
        "value": null
      },
      {
        "id": 360014970840,
        "value": null
      },
      {
        "id": 360020219099,
        "value": null
      },
      {
        "id": 360017500380,
        "value": null
      },
      {
        "id": 360020141020,
        "value": null
      },
      {
        "id": 360013773540,
        "value": "yes"
      },
      {
        "id": 360017612779,
        "value": null
      },
      {
        "id": 360017500400,
        "value": null
      },
      {
        "id": 360020141040,
        "value": null
      },
      {
        "id": 360003547379,
        "value": null
      }
    ],
    "followup_ids": [],
    "ticket_form_id": 360000846099,
    "brand_id": 511709,
    "allow_channelback": false,
    "allow_attachments": true
  }
]

json to pin in the second node, and after all should work

[
  {
    "attachment": [
      {
        "self": "link",
        "id": "10032",
        "filename": "CSV_sample.csv",
        "author": {
          "self": "link",
          "accountId": "5e7c6b0d7276650c2d5d420b",
          "avatarUrls": {
            "48x48": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png",
            "24x24": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png",
            "16x16": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png",
            "32x32": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png"
          },
          "displayName": "CPS",
          "active": true,
          "timeZone": "Europe/Berlin",
          "accountType": "atlassian"
        },
        "created": "2022-11-01T11:30:27.227+0100",
        "size": 183,
        "mimeType": "text/csv",
        "content": ".net/rest/api/2/attachment/content/10032"
      },
      {
        "self": "link",
        "id": "10031",
        "filename": "n8n.webp",
        "author": {
          "self": "link",
          "accountId": "5e7c6b0d7276650c2d5d420b",
          "avatarUrls": {
            "48x48": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png",
            "24x24": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png",
            "16x16": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png",
            "32x32": "https://secure.gravatar.com/avatar/6c86fc9f85d50419f1f89af8d3828cbb?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FCS-4.png"
          },
          "displayName": "CPS",
          "active": true,
          "timeZone": "Europe/Berlin",
          "accountType": "atlassian"
        },
        "created": "2022-11-01T11:30:27.082+0100",
        "size": 2014,
        "mimeType": "image/webp",
        "content": ".net/rest/api/2/attachment/content/10031"
      }
    ]
  }
]

Hey @Gabriele_Bracciali,

It looks like it is kind of as expected, When you use a node reference directly it will try to use the index of the item to get the value. So in this case there is only 1 item coming out of Zendesk but the attachment split is creating 2 items so when you hit the set node is checking for 2 items in the Zendesk node.

You can work around this by setting the index manually so something like {{$item(0).$node["Zendesk test"].json["id"]}} which tells it to always use the first item.

1 Like

oh super cool, that’s what i need!
thanks, i will use this trick for the next time!
Have a great day!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.