Save Some Function Items

Hi :smiley:

I wanted to save some function items in sense that the functions that I use more often I can save the block with predefined code so its just drag and drop

Cheers

1 Like

That isn’t a bad idea, I am not seen an option to save a template function node. As a temporary solution you could copy the node out and just paste it in whenever you need it but it isn’t as clean.

This might need to be moved to the requests section.

2 Likes

Hey @MXA_Music,

Can you share what functions you’re using more often? We have a data transformation node in our roadmap and your inputs would help us shape it. Here’s the link to the feature request: Transformation

Coming back to your original topic, I often create sub-workflows that I can call using the Execute Workflow node. For example, I have some workflows that extract data from different places and insert it into Airtable. Instead of having the same Airtable everywhere, I created a workflow that adds the data to Airtable.

Another alternative is to create an API of sorts. You can do this with the HTTP Request node and the Webhook node.

2 Likes

Hey @harshil1712

Its not just API calls for example I have functions to clean conf.ini files another to parse Ticket Numbers and Task Numbers from Hive and more so I created them generic but I want to save the block as it is or maybe a sequence of functions so start > Ready File using SSH > use Conf.ini Parser Function > Then I can add to it what comes next.

Hey @MXA_Music,

I believe that both the methods that I shared above can work. You can send back the response from the workflow and use it later in your workflow

1 Like

@harshil1712 I will try that and see how it works :smiley:

1 Like

I get what you are saying so create a webhook for say /internal/my-task-1 then in the workflow throw in an HTTP Request node to call the webhook URL and pass in the information and have that workflow return the results to be used in the caller.

Execute workflow looks very handy as well I like the different options for workflow location, I may have to split up some of mine to use this option where possible.

2 Likes

Yes, exactly! Creating sub-workflows has been really useful to me. It makes debugging easy and reduces the complexity of the workflow.

@harshil1712 I did sub workflows but I am not sure whats the workflow ID where can I get it. Also can I make fixed ID lets say GetHiveApiKey as an ID

Hey,

You can find the workflow ID in the URL. The number after /workflow/ is your workflow ID. n8n generates this workflow ID for you, and you can’t set it.

1 Like

@harshil1712

Well it took me sometime to understand how to split workflow to sub workflows but it did the trick

Thanks man :blush:

1 Like

That’s wonderful! Feel free to share the pain points. We would like to address them and make it easier :slight_smile:

@harshil1712 The issue is when I clone the VM with n8n or export the flows I am not sure when I import it I will have same workflows ID so I don’t have to edit the workflows again :blush:

Ah, yes. That makes complete sense. In this case, if you’re using n8n on both the VMs, you can then call the sub-workflow via the URL or alternatively use Webhook + HTTP Request nodes. But this only possible if you’re running n8n on both the VMs.