How can I access the result of a function node?

Hi, im new with working with N8N and im trying to consume the result of my function node as the input for a Jira Node that I will use to update some issues.

My workflow looks like this:

Im retrieving jira issues using a JQL expression, then I process the response from jira and take only the issue keys.

this is my function

let keys = [];
for (let i = 0; i < items.length; i++) {
  keys.push({
    json: {
      key: items[i].json.key
    }
  });
}

return keys;

What I want to do is use the response of my function node as input for the next Jira Node that will add a comment on the issue using its id.

Is there a way to reference my function node result in my jira comment node?

thanks in advance :sweat_smile:

Hey @Federico_Franco, welcome to the community :tada:

Looks like you already return an object following n8n’s data structure. In the Jira node, you could use this data by adding an expression like so:

image

In the expression editor, you can then use the browser on the left to reference the incoming data from the previous node (as long you have previously executed Function node).

The preview will only be shown for the first item, but this expression would of course work for all subsequent items too. This should btw also work without the Function node as you can also reference data coming in from the first Jira node.

On a side note: Your screenshot suggests your version of n8n could be somewhat old. Might be worth taking a look at the n8n changelog to see if any improvements/changes have been made that could help you (and if so, upgrade). For example with version 0.156.0 we introduced a new code editor for the Function node making life much easier :slight_smile: