Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - Topic Creation & Management
Answered

Global Bot Variable to be set in another topic?

(0) ShareShare
ReportReport
Posted on by 40

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?

  • MisterBates Profile Picture
    39 on at
    Re: Global Bot Variable to be set in another topic?

    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.

  • Egbert Profile Picture
    33 on at
    Re: Global Bot Variable to be set in another topic?

    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.

  • AdamHunt Profile Picture
    40 on at
    Re: Global Bot Variable to be set in another topic?

    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.

  • Verified answer
    CU22081450-0 Profile Picture
    Most Valuable Professional on at
    Re: Global Bot Variable to be set in another topic?

    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

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.

Helpful resources

Quick Links

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics