Not clearing captured info / variables when restar...
# 🤝help
k
Good day. At the end of my flow, there is a yes/no question. If no is selected, the chat ends, but if yes is selected, the conversation transitions to the first node to begin a new chat. Within the flow, info is captured and stored in variables. These variables do not clear when the chat restarts. I have added another node when yes is selected with an execute code card, which then transitions to start, but no matter what code I add, the variables do not clear/delete. Please assist with the correct process and/or code. Thank you.
a
hey @kind-flower-49557 if you're using workflow variables, they will persist as long as you're in the same flow. https://botpress.com/docs/cloud/studio/variables/
An easy way to clear them all would be to put your yes/no question in a different flow, that way when you return to your main flow, the variables are cleared already
if you're using session or other variables, you will need to clear them manually using a code card
Also, you should double-check to see if your capture cards have 'extract from history' disabled or set to 0
otherwise they will look through the chat transcript and extract all those variables you just spent so much time clearing 😄
k
Thanks Gordy. I'll give this a try. Keep well.
Hi again. I have my yes/no question in a new flow as suggested, but there is no option to navigate back to the main flow when yes is selected. how do I accomplish this?
Still not working. My main workflow captures info to variables and then provides an AI response, using those variables. This immediately transitions to a new workflow with a yes/no question. When no is selected, the conersation ends. When yes is selected, the chat transitions into a 3rd workflow, which is identical to the first. At the end of the 3rd workflow, it transissions back to the 2nd workflow to create a loop. Even with hopping to different workflows, non of the variable clear/delete, so the next conversation includes both the original feedback and the new. There must be a way to clear these variables. Please assist ASAP. Thank you.
p
raff, As Gordy said, a simple solution is to clear them manually by adding an execution card to your last node just before it exits the workflow. For each variable you want to clear, type the following: workflow.variableName = null; user.variableName = null; bot.variableName = null; //etc. You will need to replace variableName with the name of your variable and use the correct var type (workflow, user, or bot) for your variable. If you have a default value for any of your variables, set them back to the default value rather than "null".