# Custom Node get wires information?

**URL:** <https://discourse.nodered.org/t/custom-node-get-wires-information/32508>\
**Category:** General\
**Created:** [6 September 2020 14:07 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508 "2020-09-06T14:07:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![juncaofish](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juncaofish/32/18815_2.png) [@juncaofish](https://discourse.nodered.org/u/juncaofish)\
**Post date:** [6 September 2020 14:07 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/1 "2020-09-06T14:07:45Z")

</div>

Could custom node get wires information in runtime? i.e. Node **2a7d48a8.86e4f8** wires to Node **9b7e69f6.78c268** in the following flow

[  
{  
"id": "2a7d48a8.86e4f8",  
"wires": [  
[  
"9b7e69f6.78c268"  
]  
]  
}  
]

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [6 September 2020 14:20 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/2 "2020-09-06T14:20:22Z")

</div>

It might be possible (by interrogating the flows file if nothing else) but it goes against the node red philosophy. Why do you want to do it? There are usually better ways.

---

<div class="post-metadata">

**Author:** ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)\
**Post date:** [6 September 2020 14:49 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/3 "2020-09-06T14:49:51Z")

</div>

a node has the `wires` property (try `this.wires`). But, as Colin said, it is not recommended to use this

---

<div class="post-metadata">

**Author:** ![juncaofish](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juncaofish/32/18815_2.png) [@juncaofish](https://discourse.nodered.org/u/juncaofish)\
**Post date:** [7 September 2020 01:37 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/4 "2020-09-07T01:37:30Z")

</div>

I'm using node-red to execute a DAG representation from other workflow engine ([argo](https://argoproj.github.io/argo/examples/#dag)), each custom node acts as a function with input/outputs by remote call service. The DAG dependency works perfectly with node-red's data driven characteristic, but when coming to arguments passing, I found it hard to pass previous node's outputs to corresponding named parameters of downstream node for 2 reasons:

1. Downstream node needs to merge its inputs from different upstream nodes;
2. Downstream node needs to build its input parameters from corresponding output of upstream nodes, i.e. Node C requires 2 parameters: msg.param1 = msg.output1 (of upstream node A), msg.param2 = msg.output2 (of upstream node B).

I consider is it possible to get the wires dependency ahead, and each node claims its own inputs/outputs, then parameter passing could be done by using the "change" node.

Is there any workaround to solve this issue gracefully?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [7 September 2020 08:34 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/5 "2020-09-07T08:34:43Z")

</div>

> [@juncaofish](#):
>
> Node C requires 2 parameters: msg.param1 = msg.output1 (of upstream node A), msg.param2 = msg.output2 (of upstream node B).

Would it work if you used named parms from the upstream nodes? So A might send a message with msg.payload.param1 set and B might send msg.payload.param2 set and then C can combine them?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [7 September 2020 09:49 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/6 "2020-09-07T09:49:26Z")

</div>

and indeed use other msg properties like msg.from (to identify the sending node) etc... so the following node just needs to combine the .from and .outputx to create it's input param

---

<div class="post-metadata">

**Author:** ![juncaofish](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juncaofish/32/18815_2.png) [@juncaofish](https://discourse.nodered.org/u/juncaofish)\
**Post date:** [7 September 2020 13:20 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/7 "2020-09-07T13:20:49Z")

</div>

It's a solution if the parameters mapping has been determined, like: (A)output1 -\> (C)param1, (B)output2 -\> (C) param2. And "join" node could work for the combination.

The side effect is we have to process the mapping inside the custom node, which should not be coupled with node original logic, and further more, if one node outputs for multiple other nodes with different parameter names, it could be a problem.

---

<div class="post-metadata">

**Author:** ![juncaofish](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/juncaofish/32/18815_2.png) [@juncaofish](https://discourse.nodered.org/u/juncaofish)\
**Post date:** [7 September 2020 13:23 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/8 "2020-09-07T13:23:00Z")

</div>

sounds nice. will give it a try.

---

<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 November 2020 13:23 UTC](https://discourse.nodered.org/t/custom-node-get-wires-information/32508/9 "2020-11-06T13:23:02Z")

</div>

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