Notifications
Announcements
I have a global variable called postcode that I have set in one topic.
In another topic I wish to ask for a postcode, I was hoping to reuse the global variable again so that regardless of topic when I set a users postcode then we will have the postcode set for the duration of their session with the bot.
Is this possible?
Hi @AdamHunt ,
Today, you just can reuse the global variable but you can't update that.
A bot variable's name must be unique across all topics. In the case of a conflict, you'll need to rename the variable before saving your change.
https://docs.microsoft.com/en-us/power-virtual-agents/authoring-variables-bot#set-bot-variables
Thanks for confirming that for me, from a user experience its quite unhelpful as we end up asking the same question in different topics potentially.
Better to think of them as global, immutable, constants. The content or value is not variable.
I agree, it's a miss - leads to all sorts of logic gymnastics and duplication of topics to work around it.
There is a way to set and reuse a global variable ... create a topic that has a single question like "what is your postcode" that stores the entered value in a global variable. From the topics where you want to use the postcode, simply refer to the global variable - if it's set already, you'll get the value it's set to; if it's not set, the user will be asked "what is your postcode" (using the topic with the single question) and you'll be able to use the result in your other topics.
Seems that global variables are "immutable" once set, but by isolating the "set the global value" in a single question topic, you can refer to the global value elsewhere without worrying about whether it's been set or not.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Michael E. Gernaey 251 Super User 2025 Season 2
Romain The Low-Code... 201 Super User 2025 Season 2
S-Venkadesh 93 Moderator