Storing things that can be referenced by multiple flows

I have several flows that need to be different but all share some snippets or code or text that are the same, and if I need to edit one I need to edit them all.

For example I have a HTTP node that takes data from previous nodes and posts it, but at the bottom I have sort of like a signature that I add to the bottom of them.

It would be good if I could store this chunk of text in a central area, and then in the flows I can just add

{{Global REF: 123}} and that would pull in the snippet of code or text etc.

Any thoughts on this?

The new Variables feature.

Variables allow you to store and reuse values in n8n workflows.

1 Like

It’s too short , it’s only 255 characters and does this work globally across different flows .

I’m talking more about a central storage of text we can refer to an an input.

The variables above is more for calling something across a flow

I think there was a request before to allow saving parts of workflows or snippets to be used later. I guess in this case depending on what it is you are doing maybe a sub workflow could be used so that you can plug it in wherever you need it.

But it’s not a flow. It’s just adding a common bit of code to another nodes input etc.

Just saves me copy and pasting the same but of code 20 times when I need to edit it when I can edit it once and point to it from the nodes etc.

Could you not have a sub workflow with a code node that you share between them or do you also modify the bit of code as well sometimes?


Let say i have several flows that do things, then they get to a point where they use a HTTP node

now in each of the flows, it does a similar action such as post to wordpress for example, but the tags and categories and content is different, except at the bottom of the content section, there is lets say a like and subscribe section in HMTL that stays the same across all of the flows.

So you have loads of custom HTML in the content part that is pulls across the flow

and then right at then bottom is my massive chunk of code with links, SVG, html etc that is the same in the flows, but at the bottom of this section of the HTTP node.

It’d be nice to instead of edit each one individually , just add

{{ Global WP-SIG }}

which would enter all of that

<!-- wp:group {"className":"support-box","layout":{"type":"constrained"}} -->
<div class="wp-block-group support-box"><!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">A considerable amount of time and effort goes into maintaining this website, creating backend automation and creating new features and --------------------------SNIP----------
<!-- /wp:paragraph -->

That makes more sense, It would be a pain but you could currently do that with a sub workflow as well so it wouldn’t be as clean as what you are after but it would do the job.

I think there are plans to expand on the variables feature over time so eventually that would be the solution for the sort of thing you are doing with referencing text, Not sure why we put a 255 limit on the field but a migration in the future can change that.

and that works across multiple seperate workflows? So i could setup a single flow, with say a set node that just has all the common stuff in i need.

Then in my flows, trigger a sub-flow somewhere that starts that set node and then i can reference that section of text etc.

Yeah that should do the job, So in your sub workflow return the data you want and you can then use that output in the workflow you call it from.

1 Like

alright, i’ll give it a try

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