# Blocking full message in function node

**URL:** <https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396>\
**Category:** Dashboard\
**Created:** [20 July 2020 11:49 UTC](https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396 "2020-07-20T11:49:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)\
**Post date:** [20 July 2020 11:49 UTC](https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396/1 "2020-07-20T11:49:33Z")

</div>

Hello,

i would like to know how i can block a complete message in a function node.(Not with other nodes)  
ATM i use: msg.payload = {};  
but with this method i get only an empty payload.

Is there a easy way to block the full message?

Greetings  
Chorum

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [20 July 2020 11:53 UTC](https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396/2 "2020-07-20T11:53:11Z")

</div>

this will halt flow of message...

```auto
return null;

```

---

<div class="post-metadata">

**Author:** ![kushan-athukorala](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kushan-athukorala/32/21830_2.png) [@kushan-athukorala](https://discourse.nodered.org/u/kushan-athukorala)\
**Post date:** [20 July 2020 11:55 UTC](https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396/3 "2020-07-20T11:55:59Z")

</div>

Remove the return msg altogether in the function node.

---

<div class="post-metadata">

**Author:** ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)\
**Post date:** [20 July 2020 12:09 UTC](https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396/4 "2020-07-20T12:09:23Z")

</div>

Mhmm i think i post my Code:

```auto
var Check = 0;

Check = global.get("boxlivescreen");

if (Check == 17) {
    msg.payload.MQTTBoxname = "W16";
    msg = msg.payload;
     node.status({fill:"green",shape:"dot",text:Check})
} else {
    msg.payload = {};
    node.status({fill:"red",shape:"dot",text:Check})
} 

return msg;

```

return null would be nice but with msg = null; the function node blocks everything, also when it should let pass.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [20 July 2020 12:14 UTC](https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396/5 "2020-07-20T12:14:10Z")

</div>

You asked ...

> [@Chorum](#):
>
> i would like to know how i can block a complete message in a function node

I said...

> [@Steve-Mcl](#):
>
> this will halt flow of message...
> 
> ```auto
> return null;
> 
> ```

If you want conditional blockage - you should ask.

Is this what you are trying to achieve...

```auto
var Check = 0;

Check = global.get("boxlivescreen");

if (Check == 17) {
    msg.payload.MQTTBoxname = "W16";
    msg = msg.payload;
    node.status({fill:"green",shape:"dot",text:Check})
} else {
    node.status({fill:"red",shape:"dot",text:Check})
    return null; //halt flow after updating status
} 

return msg;

```

---

<div class="post-metadata">

**Author:** ![Chorum](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/chorum/32/47644_2.png) [@Chorum](https://discourse.nodered.org/u/Chorum)\
**Post date:** [20 July 2020 12:26 UTC](https://discourse.nodered.org/t/blocking-full-message-in-function-node/30396/6 "2020-07-20T12:26:44Z")

</div>

Sorry next time will discribe my wishes more clearly 🙂

that works fine!  
Didnt know that i can use the return in that way.

Thank you!
