How to Handle Missing Jira ID in n8n Workflow?

Hi everyone,

I’m building an n8n workflow to create Jira tickets from Google Sheets. My workflow follows these steps:

  1. Trigger: Google Sheets fetches new rows.
  2. HTTP Request: Searches for a Jira ID based on the email from the sheet.
  3. Create Jira Issue: Uses the retrieved Jira ID as the “reporter.”

The Problem

If the email does not belong to an existing Jira user, the HTTP request does not return any value. When this happens, the workflow does not create a Jira ticket and does not throw an error.

What I Want to Achieve

If the HTTP request fails to find a Jira ID, I want to:

  • Set a default “reporter” ID (e.g., a service account).
  • Ensure the Jira ticket is created even if the email is not in Jira.

What I Have Tried

Has anyone faced a similar issue? How do you handle missing Jira IDs in n8n? Any suggestions would be greatly appreciated!

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

@Tien_Nguyen sorry,could you tell me more details about the https? what’s the output of https?

@Alex_Huang The output is the Jira ID of Reporter corresponding to the searched email address.

Below is the configuration in my n8n for:

You can add a code block like the following:

The code block will check if the output of HTTP request exists. If it exists, it will return that output, else, you can return a different output with the “default” accountId that you want. You can then pass this code block as an input to the Jira node to create the issue.

you should add a node to classify the output of http node, if it’s failure then you could set it as a default ID

@hrishikesh I’ve set it up as you advised, but it only executes to the “HTTP Request” node. The subsequent nodes, including “Code” and “Jira create,” are not running and there are no error alerts as image:

Below is my configuration:


Apologies for the oversight. You’d have to enable the Always output data option in the HTTP request settings:

And then, try changing your code to:

if (Object.keys($input.all()[0].json).length > 0) {
  return $input.all()
}

return [
  {
    json: {
      accountId: '<id>'
    }
  }
]
2 Likes

Hi @hrishikesh, I have one more question. How can I set it up to leave the “reporter” field blank if the Jira ID does not exist?

Does Jira support that? I don’t think it will allow you to set a blank reporter.

The only absolutely required fields to create a Jira issue are Project, Issue Type and Summary. You might have required custom fields. To check them there Jira provides the metadata endpoint https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-createmeta-projectidorkey-issuetypes-issuetypeid-get

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