Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Below is a sample script evaluating the Custom control ID and dispatching accordingly.

Place the below code in a function node.

The third pin of the Flow manager node should be fed to this function node and the output of this function node should be connected back to the Flow manager node.

Code Block
var controlId = msg.payload.session.attributes.orbitaSession.flowInfo.controlId;
switch(controlId) 
{
    case "727728496933425673":
         return [msg, null];
    case "697728492533472789":
         return [null, msg];
// etc
}

This process can be used to perform a simple calculation, or dispatch control to an entirely separate Flow Studio Flow or survey.

See the following video for a detailed explanation.

...

You can also make use of the switch node if you have multiple custom controls within the same flow studio flow.

...

The property field should contain the below path

Code Block
msg.payload.session.attributes.orbitaSession.flowInfo.controlId

Flow jumping

If you want to jump to another flow and control, you can do it by replacing the flowInfo property in the output payload object.

Place the below code in a function node.

Info

The third pin of the Flow manager node should be fed to this function node and the output of this function node should be connected back to the Flow manager node.

Code Block
msg.payload.session.attributes.orbitaSession.flowInfo = {"flowId":"5ef0e39e8c9100006f001481",
  "controlId":"771065401040319953",
  "state":"IN_PROGRESS",
  "messageArray":[],"answerArray":[],
  "checkboxPntr":0,"multiOptionMode":[],
  "items":{}};
return msg;
Warning

By replacing the flowInfo property and connecting the function node to the Flow manager node, your flow will continue from the next control ID in the new flow manager flow.
In the above example code, the control ID 771065401040319953 is deemed completed and the next control id from the flow 5ef0e39e8c9100006f001481 will be rendered in the chatbot.

Using a Custom Control Name for hook data

...