In a flow which contains a flow-breaking command, such as the following, special returned value is not preserved across the break. Here, a break is created by invoking a dialog. Notice how the value returned by Dialog1 is lost after the break.
We should fix this.
onStart: [
{ start: "Dialog1", // returns "v1" flowPath = [onStart,start(Dialog1)]
then: [ // value="v1" flowPath = [onStart,start(Dialog1),then]
// starting Dialog2 breaks the flow (Dialog2 starts a new flow)
{ start: "Dialog2", // returns "v1" flowPath = [onStart,start(Dialog1),then,start(Dialog2)]
then: [ // value="v2" here flowPath = [onStart,start(Dialog1),then,start(Dialog2),then]
]
},
// this is the nextFlow of the "onStart.start(Dialog1).then" flow
"Value is {{value}}" // expecting this to send message "Value is v1",
// but bot sends "Value is undefined"
]
]
One solution is to:
- Detect whether flow has a next flow
- If
value is set in the flow, save it to a hidden variable before each flow breaker
E.g., save value v1 in flow onStart.start(Dialog.then to a local session var, such as:
"__value__:onStart.start(Dialog1).then" = "v1"
This would happen just before {start: "Dialog2" ...}
- Load the value at the beginning of the nextFlow
- clear the value at the end of the last nextFlow
In a flow which contains a flow-breaking command, such as the following, special returned
valueis not preserved across the break. Here, a break is created by invoking a dialog. Notice how the value returned by Dialog1 is lost after the break.We should fix this.
One solution is to:
valueis set in the flow, save it to a hidden variable before each flow breakerE.g., save value v1 in flow onStart.start(Dialog.then to a local session var, such as:
"__value__:onStart.start(Dialog1).then" = "v1"This would happen just before
{start: "Dialog2" ...}