How to use context variables in Sub intent

Hi Team,

I am trying to capture dateFrom context variable in Welcome Intent in Script node.

context.dateFrom = d.toISOString();

Now I want to use it in sub intent of SF Case Creation Intent. Where I am trying to print dateFrom, I am getting undefined printed in debug log.

How can I read this value into sub intent?

Hi @praful_dhone,

The context variable is independent of the dialog type.

Please let us know if you are able to retrieve the context variable “dateFrom” value in a normal dialog.

Regards,
Yoga Ramya

@yogaramya.mendu Thank you for your response. :slight_smile:

dateFrom I can access it every where within same dialog. But can not access in other dialog. For that I used BotUserSession where I am putting BotUserSession.put(“dateFrom”, dateFrom, 30);

In this way, I can read BotUserSession in other dialog. Please let me know if I am doing it in correct way or not.

Hi @praful_dhone,

Yes, you will need to use the BotUserSession variable to use data across dialog tasks within a bot.

The value stored in the context variable will be only available for that task.

Please check the following documentation for more information:
https://developer.kore.ai/docs/bots/bot-builder-tool/dialog-task/using-session-and-context-variables-in-tasks/

Regards,
Yoga Ramya

1 Like