# Trigger New process when previous node finish working

**URL:** <https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545>\
**Category:** General\
**Created:** [24 February 2021 12:26 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545 "2021-02-24T12:26:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![nadeemciit102](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nadeemciit102/32/36017_2.png) [@nadeemciit102](https://discourse.nodered.org/u/nadeemciit102)\
**Post date:** [24 February 2021 12:26 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/1 "2021-02-24T12:26:27Z")

</div>

Hi All,

I need to start new process when previous nodes finish working (like Post or get request response received)  
But I don't want to pass msg data got from previous node.

Regards,

---

<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:** [24 February 2021 13:33 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/2 "2021-02-24T13:33:27Z")

</div>

Add a change node between the two nodes to remove the data you don't want passed on.

---

<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:** [24 February 2021 13:39 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/3 "2021-02-24T13:39:20Z")

</div>

or drop a function node in and put...

```auto
return {}; 

```

.. to return a brand new empty `msg`

---

<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:** [24 February 2021 13:47 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/4 "2021-02-24T13:47:49Z")

</div>

Though I get a feeling that we have misunderstood the question.

---

<div class="post-metadata">

**Author:** ![nadeemciit102](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nadeemciit102/32/36017_2.png) [@nadeemciit102](https://discourse.nodered.org/u/nadeemciit102)\
**Post date:** [24 February 2021 13:50 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/5 "2021-02-24T13:50:03Z")

</div>

Thanks Colin, I have tried Change node. Yes, I can change the payload value whatever I need. But what about the other value under the msg object (Like headers, Status Code, response URL etc). They are passing as it is to the next node and then the other.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7d41212d6004f80539761633cf35ca82da1f9ac8.png)

Regards,  
Nadeem

---

<div class="post-metadata">

**Author:** ![nadeemciit102](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nadeemciit102/32/36017_2.png) [@nadeemciit102](https://discourse.nodered.org/u/nadeemciit102)\
**Post date:** [24 February 2021 13:58 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/6 "2021-02-24T13:58:01Z")

</div>

Oh Great. Thanks you Soo Much. That one worked.  
I was thinking that there may be a node to achieve that. But I am getting the object with msgid only atleast.

Thanks a lot.

Regards,

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [24 February 2021 13:58 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/7 "2021-02-24T13:58:05Z")

</div>

Can the Complete node be useful here?

```auto
[{"id":"a3bf9dc0.0c472","type":"complete","z":"9f4fbba4.68ceb8","name":"","scope":["8058430c.31e7b"],"uncaught":false,"x":350,"y":960,"wires":[["1e87e06c.8d018"]]},{"id":"1e87e06c.8d018","type":"debug","z":"9f4fbba4.68ceb8","name":"COMPLETE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":960,"wires":[]},{"id":"8058430c.31e7b","type":"function","z":"9f4fbba4.68ceb8","name":"test Done","func":"var to = setTimeout(forDone,1000)\nfunction forDone(){\n msg.payload = \"Changed content\"\n node.done()\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":360,"y":1040,"wires":[["ea250a09.01c238"]]},{"id":"bbdec98d.9320e8","type":"inject","z":"9f4fbba4.68ceb8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Message content","payloadType":"str","x":200,"y":1040,"wires":[["8058430c.31e7b"]]},{"id":"ea250a09.01c238","type":"debug","z":"9f4fbba4.68ceb8","name":"FUNCTION","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":530,"y":1040,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![nadeemciit102](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nadeemciit102/32/36017_2.png) [@nadeemciit102](https://discourse.nodered.org/u/nadeemciit102)\
**Post date:** [24 February 2021 14:04 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/8 "2021-02-24T14:04:17Z")

</div>

Hi,

I have tried complete node. But in my case I am getting few values from the previous POST request which I don't want to pass to the next node. I just need to trigger the next process when first process become completed.

Like Send post API get response, Display values on Dashboard UI  
Then start new API request in sequence.

---

<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:** [24 February 2021 14:25 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/9 "2021-02-24T14:25:05Z")

</div>

for reference, there is usually no _real_ need to delete the msg contents (or create a new mesage) - you just ignore the extra bits in the msg. In fact, for debugging and performance (sometimes) purposes or downstream operations, it is quite desirable to leave the msg as-is.

---

<div class="post-metadata">

**Author:** ![nadeemciit102](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nadeemciit102/32/36017_2.png) [@nadeemciit102](https://discourse.nodered.org/u/nadeemciit102)\
**Post date:** [25 February 2021 11:06 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/10 "2021-02-25T11:06:05Z")

</div>

Hi Steve,

I got your point. But in my case if sequence of API creates many bits in response and transfer it to the next node, It will be difficult with me to debug, Like which node produce which bits.

Also is there any way to keep only **msg.payload** and ignore all extra bits? Or just use previous **msg** to trigger new sequence and pass only a new payload (which will defined by function itself) using function node instead of brand new empty **msg**

Thanks

---

<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:** [25 February 2021 11:10 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/11 "2021-02-25T11:10:07Z")

</div>

> [@nadeemciit102](#):
>
> Also is there any way to keep only **msg.payload** and ignore all extra bits?

Yes...

```javascript
return { payload: msg.payload }; //new object with payload from original msg

```

---

<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:** [11 March 2021 11:10 UTC](https://discourse.nodered.org/t/trigger-new-process-when-previous-node-finish-working/41545/12 "2021-03-11T11:10:38Z")

</div>

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