Skip to content

Commit 311c4df

Browse files
committed
Allow targetid and workflowid for RPA Workflow nodes
1 parent c8b207f commit 311c4df

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

OpenFlowNodeRED/src/nodered/nodes/rpa.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@
8787
</div>
8888
</script>
8989
<script type="text/x-red" data-help-name="rpa workflow">
90-
Send payload as data to a robot, requesting it to run the selected Workflow
90+
Send payload as data to a robot, requesting it to run the selected Workflow.<br>
91+
You can set Workflow using msg.workflowid<br>
92+
You can set Target using msg.targetid<br>
9193
</script>
9294
<script type="text/javascript">
9395
RED.nodes.registerType('rpa workflow', {
@@ -96,8 +98,8 @@
9698
paletteLabel: 'robot',
9799
icon: "open_rpa_white.png",
98100
defaults: {
99-
queue: { value: "", required: true },
100-
workflow: { value: "", required: true },
101+
queue: { value: "" },
102+
workflow: { value: "" },
101103
localqueue: { value: "" },
102104
name: { value: "" }
103105
},

OpenFlowNodeRED/src/nodered/nodes/rpa_nodes.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,19 +157,29 @@ export class rpa_workflow_node {
157157
async oninput(msg: any) {
158158
try {
159159
this.node.status({});
160+
let targetid = NoderedUtil.IsNullEmpty(this.config.queue) || this.config.queue === 'none' ? msg.targetid : this.config.queue;
161+
let workflowid = NoderedUtil.IsNullEmpty(this.config.workflow) ? msg.workflowid : this.config.workflow;
160162
var correlationId = Math.random().toString(36).substr(2, 9);
161163
this.messages[correlationId] = msg;
162164
if (msg.payload == null || typeof msg.payload == "string" || typeof msg.payload == "number") {
163165
msg.payload = { "data": msg.payload };
164166
}
167+
if(NoderedUtil.IsNullEmpty(targetid)) {
168+
this.node.status({ fill: "red", shape: "dot", text: "robot is mandatory" });
169+
return;
170+
}
171+
if(NoderedUtil.IsNullEmpty(workflowid)) {
172+
this.node.status({ fill: "red", shape: "dot", text: "workflow is mandatory" });
173+
return;
174+
}
165175
var rpacommand = {
166176
command: "invoke",
167-
workflowid: this.config.workflow,
177+
workflowid: workflowid,
168178
jwt: msg.jwt,
169179
data: { payload: msg.payload }
170180
}
171181
this.node.status({ fill: "blue", shape: "dot", text: "Robot running..." });
172-
this.con.SendMessage(JSON.stringify(rpacommand), this.config.queue, correlationId, true);
182+
this.con.SendMessage(JSON.stringify(rpacommand), targetid, correlationId, true);
173183
} catch (error) {
174184
NoderedUtil.HandleError(this, error);
175185
try {

0 commit comments

Comments
 (0)