# How to set node status from within Editor

**URL:** <https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605>\
**Category:** Developing Nodes\
**Created:** [28 September 2021 08:40 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605 "2021-09-28T08:40:23Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 08:40 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/1 "2021-09-28T08:40:23Z")

</div>

Is it possible to set a node's status from within the editor?

Simply invoking `node.status(...)` does not seem to work.

---

<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:** [28 September 2021 09:00 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/2 "2021-09-28T09:00:56Z")

</div>

No, the node status is a runtime property of the node. Setting it at edit time doesn't make sense.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 09:49 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/3 "2021-09-28T09:49:25Z")

</div>

Well...

...how can I then tell the flow developer which other nodes have to be reconfigured because he/she changed a setting in the currently edited node?

---

<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:** [28 September 2021 10:08 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/4 "2021-09-28T10:08:49Z")

</div>

I don't think most developers would expect nodes are coupled in such a way that changing the config of one node makes that of another invalid. But if that were the case I would expect the node to show the red triangle.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 10:25 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/5 "2021-09-28T10:25:34Z")

</div>

Well, this may be the obvious solution - but that triangle can not be programmatically set (only indirectly by a property validator)

---

<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:** [28 September 2021 11:49 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/6 "2021-09-28T11:49:06Z")

</div>

> [@rozek](#):
>
> ...how can I then tell the flow developer which other nodes have to be reconfigured because he/she changed a setting in the currently edited node?

Nodes are not meant to interact that way. Generally nodes have no knowledge of other nodes in a flow.

If you really need to couple nodes this way, either add some control data to the msg object (make sure you use a unique property name that won't have a clash with other things. Maybe also starting with an underscore to illustrate that it shouldn't be messed with. Just note that some nodes might not actually pass through a msg but might recreate it - they generally shouldn't but it can happen). Or use a shared configuration node.

But ideally, probably try to avoid such tight coupling of nodes.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 11:53 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/7 "2021-09-28T11:53:04Z")

</div>

Well, this does not seem to be true: the best known counter-example are perhaps http-in and http-out nodes. From a user-centric perspective, I'd prefer if these nodes would know (and indicate) if they are properly connected or not!

And I can easily think of other node pairs and triples with the same relationship

---

<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:** [28 September 2021 11:57 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/8 "2021-09-28T11:57:23Z")

</div>

> [@rozek](#):
>
> Well, this does not seem to be true

It _is_ true "in general". There are, of course, some exceptions. But even so, the example you give does not tightly couple the nodes in the way you suggested. Indeed, they are very loosely coupled. For example, you could have multiple http-out nodes for a single http-in or the other way around I think as well. And you can have pretty much any processing in between them. But if you delete the req/res data, the out node will most likely struggle.

Those nodes share information via the msg object as I suggested.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 12:15 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/9 "2021-09-28T12:15:14Z")

</div>

Well, personally, I still consider "http-in" and "http-out" as tightly connected - independent of how many nodes of the first kind are connected to nodes of the second kind (or vice-versa) I would only call "catch" nodes as "loosely coupled".

But this is not the point: the editor principally has enough information to tell the developer, which "http in" node has no (tight) connection to any "http out" node (and vice-versa) and should indicate that.

This is why I asked for explicitly setting the node status or error triangle

---

<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:** [28 September 2021 12:27 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/10 "2021-09-28T12:27:54Z")

</div>

> [@rozek](#):
>
> This is why I asked for explicitly setting the node status or error triangle

The recently published lint tool, `nrlint` includes a rule that tries to highlight `HTTP In` and `HTTP Response` nodes that are unpaired. It isn't perfect - it doesn't consider all possible Catch/Complete paths - but obviously open to contribution to improve.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 12:37 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/11 "2021-09-28T12:37:30Z")

</div>

Hmmm, I already read about `nrlint` in this forum - but is it right that, when I develop new custom nodes, I will also have to update the rules for `nrlint`?

---

<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:** [28 September 2021 12:43 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/12 "2021-09-28T12:43:13Z")

</div>

> [@rozek](#):
>
> when I develop new custom nodes, I will also have to update the rules for `nrlint` ?

I'm just pointing you to something that exists that you could choose to use today.

As I've said to you before, you are trying to do things that haven't been done in the core - so yes, you are hitting limitations of the API that could be improved.

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [28 September 2021 15:50 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/13 "2021-09-28T15:50:29Z")

</div>

If it is a custom node that is being edited, you could add an `oneditsave` function that contains the `node.status` call that you want.

---

<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:** [28 September 2021 16:11 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/14 "2021-09-28T16:11:05Z")

</div>

> [@drmibell](#):
>
> you could add an `oneditsave` function that contains the `node.status` call that you want.

No you couldn't. You cannot set it in the editor.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 16:11 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/15 "2021-09-28T16:11:26Z")

</div>

really? node.status is still not present

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [28 September 2021 16:38 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/16 "2021-09-28T16:38:06Z")

</div>

> [@knolleary](#):
>
> You cannot set it in the editor.

Right. That's what happens when I don't test things...

> [@rozek](#):
>
> how can I then tell the flow developer which other nodes have to be reconfigured because he/she changed a setting in the currently edited node?

I was responding to this question. Couldn't `oneditsave` set a message (in the `defaults` object) for the node to put in the status text when it is deployed?

---

<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:** [28 September 2021 16:44 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/17 "2021-09-28T16:44:07Z")

</div>

> [@drmibell](#):
>
> Couldn't `oneditsave` set a message (in the `defaults` object) for the node to put in the status text when it is deployed?

Yes it could. But the requirement is to highlight an issue at edit time, not deploy time.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 16:44 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/18 "2021-09-28T16:44:11Z")

</div>

I'm not talking about the post-deployment state - that's trivial. I need s.th. for the pre-deployment state!

---

<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:** [28 September 2021 17:09 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/20 "2021-09-28T17:09:57Z")

</div>

Sorry @TotallyInformation, but this isn't about communicating between modules. This isn't about communicating between the editor and runtime. This isn't really about setting the node status from the editor.

As I said in the first reply - node status is a runtime concept. It is not an edit time concept.

And as @rozek has responded a few times - this is about being able to show edit-time validation errors that span multiple nodes. He was interested in status as one possible route to displaying that type of error - which is not the right approach.

> [@TotallyInformation](#):
>
> Then, as you change settings in the editor panel, you can call the API which would, in turn access a node's runtime to set the status. Because JavaScript passes variables by reference link, it is possible to keep references in a common module.

No. You should not, cannot not, must not entertain setting status from the editor. Just because you can conceive of a technical path that would make it happen, it doesn't mean it should be encouraged, explained or done.

Given I said in my very first reply it doens't make sense to do it, I would have hoped others would have taken the hint.

Besides - your suggestion wouldn't work in the case of a newly added, never deployed, node.

---

<div class="post-metadata">

**Author:** ![rozek](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rozek/32/48594_2.png) [@rozek](https://discourse.nodered.org/u/rozek)\
**Post date:** [28 September 2021 17:12 UTC](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605/21 "2021-09-28T17:12:06Z")

</div>

...all this just because I can't set error indicators on other nodes within the editor? Because that was the initial question I had (setting the node status from within the editor was only an alternative)

Meanwhile (after two days of hacking) I've given up doing pre-deployment cross-node tests and do so upon loading all flows into the runtime, setting node stati on failures - that works reliably

[Next page](https://discourse.nodered.org/t/how-to-set-node-status-from-within-editor/51605.md?page=2)
