This repository was archived by the owner on Jan 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexternaltask-output.js
More file actions
36 lines (29 loc) · 1.43 KB
/
externaltask-output.js
File metadata and controls
36 lines (29 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module.exports = function (RED) {
function ExternalTaskOutput(config) {
RED.nodes.createNode(this, config);
const node = this;
node.on('input', function (msg) {
const flowNodeInstanceId = msg.flowNodeInstanceId;
const processInstanceId = msg.processInstanceId;
const etw_input_node_id = msg.etw_input_node_id;
if (!etw_input_node_id) {
node.error('Error: The message did not contain the required etw_input_node_id.', msg);
} else {
const etwInputNode = RED.nodes.getNode(etw_input_node_id);
if (!etwInputNode) {
node.error('Error: The message did not contain the required etw_input_node_id.', msg);
} else {
if (!flowNodeInstanceId) {
node.error('Error: The message did not contain the required external task id.', msg);
} else {
node.log(
`handle-${flowNodeInstanceId}: *flowNodeInstanceId* '${flowNodeInstanceId}' and *processInstanceId* '${processInstanceId}' with *msg._msgid* '${msg._msgid}'`,
);
}
etwInputNode.eventEmitter.emit(`handle-${flowNodeInstanceId}`, msg, false);
}
}
});
}
RED.nodes.registerType('externaltask-output', ExternalTaskOutput);
};