# How to share sub-flows as Pallet?

**URL:** <https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772>\
**Category:** General\
**Created:** [22 July 2021 11:48 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772 "2021-07-22T11:48:01Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnab](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Arnab](https://discourse.nodered.org/u/Arnab)\
**Post date:** [22 July 2021 11:48 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/1 "2021-07-22T11:48:01Z")

</div>

Hi our team is currently working on a project where we have created few sub-flows for specific functions. We share sub-flows through JSON as of now.  
But we are thinking to move to sharing the sub-flows where it cannot be edited/changed to prevent any issue.  
So I am curious to know if there is any way we can share them by converting it to a pallet (such as function, http etc.) without publishing it publicly as of now.  
Or is there any imminent feature to be added in Node-RED which might help in this regard?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 July 2021 16:52 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/2 "2021-07-22T16:52:13Z")

</div>

Welcome to the forum @Arnab

Generally it is best to start with the official Node-RED documentation.

[https://nodered.org/docs/creating-nodes/subflow-modules](https://nodered.org/docs/creating-nodes/subflow-modules)

---

<div class="post-metadata">

**Author:** ![Arnab](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Arnab](https://discourse.nodered.org/u/Arnab)\
**Post date:** [23 July 2021 12:40 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/3 "2021-07-23T12:40:44Z")

</div>

Hi @TotallyInformation Thank you.  
I have tried to convert a sub-flow to a node with this method.

The issue i am facing is that the input and output nodes are not showing on the converted node.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/f/0fd2362e620fad6a911152e01594394c5e078f26.png)  
Can you please help me with what I have to do to have the input/output working?

Previously it was like this:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1a2e64c61d32730189fb3c1e640ddc23284b002.png)

---

<div class="post-metadata">

**Author:** ![paulkeates](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paulkeates](https://discourse.nodered.org/u/paulkeates)\
**Post date:** [23 July 2021 13:29 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/4 "2021-07-23T13:29:11Z")

</div>

Hi,

I've never tried to share sub-flows that way but have used them extensively.

The input / output 'ports' (connection points) are controlled in the subflow properties dialog:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/96b19ef5f6da2b23bfda6aa35b3397b62f551ff4.png)

Set input = 1 and output = however many are needed / relevant.

I hope that helps.

Cheers,

Paul

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [23 July 2021 13:33 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/5 "2021-07-23T13:33:56Z")

</div>

> [@Arnab](#):
>
> Can you please help me with what I have to do to have the input/output working?

You shouldn't need to anything beyond what the docs describe.

Can you share a copy of the subflow json you've created using the instructions in the docs?

---

<div class="post-metadata">

**Author:** ![Arnab](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Arnab](https://discourse.nodered.org/u/Arnab)\
**Post date:** [23 July 2021 13:46 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/6 "2021-07-23T13:46:18Z")

</div>

Here it it, stripped down the code a little bit:

```auto
{
  "id": "31ac1d10.6d4e72",
  "type": "function",
  "z": "a426e26b.67424",
  "name": "Create Postprocessing Info",
  "func": "return msg;",
  "outputs": 1,
  "noerr": 0,
  "initialize": "",
  "finalize": "",
  "libs": [],
  "x": 320,
  "y": 80,
  "wires": [[]],
  "flow": [
    {
      "id": "a426e26b.67424",
      "type": "subflow",
      "name": "Create Postprocessing Info",
      "info": "",
      "category": "SPPA",
      "in": [{ "x": 40, "y": 80, "wires": [{ "id": "31ac1d10.6d4e72" }] }],
      "out": [
        { "x": 580, "y": 80, "wires": [{ "id": "31ac1d10.6d4e72", "port": 0 }] }
      ],
      "env": [{ "name": "Name", "type": "str", "value": "Processor" }],
      "meta": {
        "module": "create-postprocessing-info",
        "version": "1.1.0",
        "author": "...",
        "desc": "A node to stack up the msg.Message.IoT structure with a describing name and timestamp when the node was passed."
      },
      "color": "#6090ff"
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [23 July 2021 13:51 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/7 "2021-07-23T13:51:45Z")

</div>

Hi @Arnab

that JSON is not correct. You have a `function` node at the top level and the `subflow` node inside the `flow` property. It should be the other way around.

---

<div class="post-metadata">

**Author:** ![Arnab](https://avatars.discourse-cdn.com/v4/letter/a/439d5e/32.png) [@Arnab](https://discourse.nodered.org/u/Arnab)\
**Post date:** [23 July 2021 13:57 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/8 "2021-07-23T13:57:04Z")

</div>

Hi @knolleary it worked! Thank you a lot.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 August 2021 13:57 UTC](https://discourse.nodered.org/t/how-to-share-sub-flows-as-pallet/48772/9 "2021-08-06T13:57:52Z")

</div>

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