Not able to access context variable created inside script node in message node after bot action node.

Hii i am new to Kore.ai i am exploring kore.ai feature. I have created a script node to validate data and sending valid response to the user.

ScriptNode name: ProcessData

has this script

context.moneyLeft;
if(context.entities.Money<=30000) {
context.moneyLeft = {
“money” : 30000-context.entities.Money,
“message” : “Money tranfered Successfully.”
};
}else {
context.moneyLeft = {
“money” : 30000,
“message” : “Sorry you don’t have this much amount in your account.”
};
}

When i am trying to use

{{context.ProcessData.moneyLeft.money}} inside message node after BotAction Node, i am getting error.

@caditi009
{context.ProcessData.moneyLeft.money seems invalid. You cannot access any variable inside a script node in another node. The scope is lost once the script execution is done. If you want to emit any value/JSON, you will need to emit it using a context variable - as you used - context.moneyLeft.

The contextmoneyLeft.money needs to be used inside the Message node’s JS section as stringified JSON - shown below. Else it will not resove.

print(JSON.stringify(context.moneyLeft));