# Passing arguments into a custom node

**URL:** <https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990>\
**Category:** General\
**Created:** [24 May 2022 06:23 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990 "2022-05-24T06:23:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vedant](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@Vedant](https://discourse.nodered.org/u/Vedant)\
**Post date:** [24 May 2022 06:23 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990/1 "2022-05-24T06:23:59Z")

</div>

Hello Everyone! I am trying to customize the node that I created. Right now the inject node triggers the functionality i.e. passes the argument and the custom node that I created passes the results and errors to the debug node. I want to ask if there is a way that I can pass these arguments in the custom node itself instead of the inject node? I want that both the inject node and the customnode must be able to take the arguments if the inject node does not input anything the custom node should be able to pass the arguments.  
I am attaching some pictures for your reference. Thank you!

 ![B](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/423abb4985abff15b1449a8b9b00839da3b995e1.png)

 ![API node-red](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/8/f8f5cc7002d0fcc51f68460ea72be0fe353df202.png)

 ![AA](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/9/99c00c55a27d717daa76ca1d20478d737517c5be.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 May 2022 07:37 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990/2 "2022-05-24T07:37:45Z")

</div>

You may need a `change` node to do that.

It would go in _parallel_ with the `inject` node and the `change` node's variables are set from other parameters.

eg: context.

---

<div class="post-metadata">

**Author:** ![Vedant](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@Vedant](https://discourse.nodered.org/u/Vedant)\
**Post date:** [24 May 2022 07:42 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990/3 "2022-05-24T07:42:35Z")

</div>

I understand what you mean but is there a way I can directly input these parameters into the custom node by editing the html or js code that I wrote?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [24 May 2022 07:44 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990/4 "2022-05-24T07:44:28Z")

</div>

But node-red works with the idea of message being the transport mechanism.

So messages are sent between nodes via a message.

So when something changes, it causes a message to be sent from one node to the next.  
(The next node in this case is yours.)

And so it receives the new message with the new variables.

---

<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:** [24 May 2022 07:51 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990/5 "2022-05-24T07:51:13Z")

</div>

Yes - you can create a configuration panel using the .html file. See the docs and the sample files [Creating your first node : Node-RED](https://nodered.org/docs/creating-nodes/first-node)

---

<div class="post-metadata">

**Author:** ![Vedant](https://avatars.discourse-cdn.com/v4/letter/v/ba9def/32.png) [@Vedant](https://discourse.nodered.org/u/Vedant)\
**Post date:** [24 May 2022 08:51 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990/6 "2022-05-24T08:51:52Z")

</div>

Thank you very much I was able to pass the arguments into the custom node

---

<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:** [7 June 2022 08:52 UTC](https://discourse.nodered.org/t/passing-arguments-into-a-custom-node/62990/7 "2022-06-07T08:52:16Z")

</div>

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