Adding new labels to a Jira issue

Describe the problem/error/question

I want to create a Jira issue with a label set on it. The label can be one of a few options:

  • Single word eg: example
  • Multi word eg: example label
  • Multiple labels eg: example, label

These specific labels may or may not exist in Jira prior to my trying to create an issue.

Creating an issue fails with an error saying the labels need to be in an array of strings, but that is already what I am providing.

What is the error message (if any)?

400 - {"errorMessages":[],"errors":{"labels":"Specify the value for labels in an array of strings"}}
NodeApiError: Bad request - please check your parameters
    at Object.requestWithAuthentication (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:1092:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.jiraSoftwareCloudApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Jira/GenericFunctions.js:40:16)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Jira/Jira.node.js:461:36)
    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

With the value of the label field being set like so:
Google Chrome 2023-07-20 at 16.19.25

Information on your n8n setup

  • n8n version: 0.234.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

I looked into it and there seems to be no similar question in this community so far.

Hi @Boris_Modus :wave: Welcome to the community! :cake:

When I tested just there with an array, I was able to successfully sent multiple labels over to Jira:


Would you be able to share your full workflow, and perhaps provide some example data in the format and structure that you’re currently using in n8n? I’m wondering if something might be going on with that Split in Batches node but I couldn’t say for certain with the information you’ve provided :thinking:

The whole workflow is:

With the array coming from the RSS Source block.

1 Like

Hi @Boris_Modus - thanks for that, and now I can see that issue :thinking: I’m not too sure what’s going on here, so I’ve flagged this with our developers to take a look. I’ll let you know when I have any updates!

Hey @Boris_Modus,

I was just taking a look at this and the value you are sending while it looks like an array is still a string as that is what is being returning from the RSS Source.

A quick solution to this one would be to convert the datatype so in your Jira node for the Label Names try using {{ JSON.parse($('RSS Source').item.json.keyword) }} This should then change the text under it to show that it is an array.

image

Let me know how you get on with this one.

1 Like

Hmm looks like the solution was actually a bit different. The key was to remove the double quotes from the RSS Source, then the whole thing worked with a direct pointer to the object.

It should be noted that the validation for the label field should be updated to allow Arrays:
Google Chrome 2023-07-25 at 09.18.15

2 Likes

Hey @Boris_Modus,

That is interesting for me it was the JSON.parse() that worked without changing the RSS Source as I was working under the assumption that the RSS data would stay the same.

The validation icon is something we are aware of and will fix it in the future.

2 Likes

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