You could use my node-red-contrib-msg-resend with number of resends equal to 1 and force-cloning-advanced activated. But I think publishing a new extra simple node-red-contrib-msg-clone node cannot harm anybody, and is much more clear in what it does ...
Bart
Does that do a deep clone? In other words if msg.payload is a reference to an object in global context will it make a copy of the object itself or just make a copy of the reference?
This is for something that lets you choose what object you want you want to copy inc flow/global contexts - and to give a choice of where to stick the copy
[edit]And for users who want to avoid writing functions[/edit]
I think that cloneMessage has a couple of tricks - doesn't it strip circular references and possibly some of the c***p that ExpressJS adds to an incoming request. Otherwise, I think that it is a straight deep clone.
Heh... well the idea is useful, imo -- but sounds like it should be an option on the change node to me. The main sticky bit will be that the change node does not currently let you "replace" the entire incoming msg with a changed (or cloned) object or partial object (although it has been discussed in the past as a good thing to have).
I agree, there should be a Copy or Clone (to reuse current Node-Red JS terminology) Also the JSONata functions (flow-get) could have an optional parameter to Clone (T/F)
Hi @cymplecy, just read through the complete thread. It was very interesting for me since I am trying to achieve something similar. So Just want to know if this Node available today ?