web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Passing context variab...
Copilot Studio
Answered

Passing context variables from contact center to copilot studio bot

(1) ShareShare
ReportReport
Posted on by 69
Created separate topic "Set context variables" (not invoked, as per documentation)
Copilot Studio Configuration:
Created separate topic "Set context variables" (not invoked, as per documentation)
Variable Global.Name, Global.Email, Global.Phone configured with:
Global scope (any topic can access)
External sources can set values ✅
Reference: "Get value from this node if empty"
 
The context variables work perfectly and appear in the agent summary when a human agent accepts the chat. The issue is specifically with the bot not receiving this context data at chat initialization.
 
I am using no authentication for both copilot studio agent and the omnichannel and it is still not working.

I even tried displaying the values before and after setting the context variables (you can see the before case below working properly), however after setting the context variable they are all null.
 
Kindly find below some screenshots for your reference.
 
Did anyone find any resolution or workaround for this issue?


The above are demo data.


Followed Microsoft's official documentation and as mentioned in this thread.


This message node is the one displayed directly after setting the context variables in the first screenshot
 
Any assistance on this as soon as possible is much appreciated
Categories:
I have the same question (0)
  • Suggested answer
    Sayali Profile Picture
    Microsoft Employee on at
    Hello,
    Global context variables defined in a non-invoked topic in Microsoft Copilot Studio / Dynamics 365 Omnichannel are not loaded into the bot runtime at chat start. These variables are stored at the conversation level and are mainly intended for human agent context during escalation, not for initializing the bot.
    Why this happens:
    Omnichannel uses two separate pipelines:
    • Bot runtime context – only includes data from topics that actually execute.
    • Agent context – includes global context variables and session data used for summaries and handoff.
    • Because the topic that sets the variables never runs, the bot cannot access them, even though agents can see them later.
    What does not work:
    • Using non-invoked topics to initialize bot variables
    • Treating global variables as startup variables
    • Expecting pre-chat or authentication settings to populate bot memory
    • Reading variables immediately after setting them in a non-executed topic
    Supported solutions:
    1. Use the Start / Conversation Start topic to set variables so the bot runtime can access them.
    2. Map Omnichannel pre-chat fields directly to bot variables in the workstream configuration.
    3. Pass values through channelData on the first turn and assign them to variables (advanced scenario).
    Key takeaway:
    For a bot to access variables, the topic that sets them must execute. Non-invoked topics are designed for agent handoff context, not bot initialization.
  • TI-09120726-0 Profile Picture
    69 on at
    Hello @Sayali, this is as per Microsoft official documentation for using context variables in the copilot studio agent, please refer to the following doc: Configure context variables for agents | Microsoft Learn

    From the documentation:

    To have your Copilot agent read context variables from Dynamics 365 Contact Center, do the following steps:

    1. On the Topics page, select Add a topic > from blank. Use a topic that isn't invoked or already exists because otherwise the context variable won't work.
    2. Enter a name for your topic, such as Set context variables, and save it.

    3. Add a new node to the topic, and select Variable management > Set a variable value.

    4. In your new node, under Set variable select Create a new variable.

    5. Open the Variable properties pane by selecting the new variable name. In the pane, set the Variable name to match the Omnichannel context variable name exactly (it's case sensitive).

    6. In the Reference section, select the vertical ellipses, and then select Get value from this node if empty. The Copilot Studio agent retrieves the variable value from this node at runtime.

    7. In the Usage section, select Global (any topic can access) and External sources can set values so that Copilot Studio agent accepts data from omnichannel and this variable can be used in any topic.

    8. If you are using data from your work classification rules in the variable, make sure that you set a time-out length in the variable definition. Learn more in Set global variables from external sources.

    9. Close the Variable properties pane.

    10. In your node, enter a value in To value that matches the data type your agent expects.

    Screenshot of a context variable in a topic in Copilot Studio.

    The topic is being executed as it is being routed to from the conversation start topic.

    I also tried your approach and it did not work, I faced the same issue unfortunately.

  • Suggested answer
    Sayali Profile Picture
    Microsoft Employee on at
    Hello,
    Thanks for sharing the information. We will check this with internal team and get back to you.
  • Suggested answer
    Sayali Profile Picture
    Microsoft Employee on at
    Hello,
    You are correctly following the official Microsoft Learn guidance for configuring context variables in Copilot Studio, but the issue you’re experiencing is due to a gap between the documented design and the actual runtime behavior in Omnichannel + Copilot Studio. Although context variables are properly received from Omnichannel, stored, and visible in Agent Summary and to human agents, they are not hydrated into the bot’s execution context until after the first conversational turn completes.
    As a result, variables resolve as null when referenced in the first bot message. Additionally, setting To value = Text("") unintentionally overwrites externally provided values because an empty string is treated as a valid assignment—this clears the injected context variable entirely. The correct configuration is to define the variable node without setting a “To value” at all, and then force a turn boundary (for example, by adding an intermediate message like “Thanks, setting things up…”) before referencing Global.* variables.
    This behavior is not related to authentication and occurs consistently across guest, authenticated, test, and live Omnichannel scenarios. In summary, this is a known runtime timing limitation and documentation gap, not a misconfiguration, and the supported workaround is to leave “To value” unset and reference context variables only after one conversational turn.
  • Verified answer
    TI-09120726-0 Profile Picture
    69 on at
    Hi @Sayali

    As I mentioned earlier you can not create a variable node without setting the 'set to' value. 

    In addition to this I was successfully able to pass the variables and use them at runtime through question nodes.
    I used the question node instead of set variable value and it worked. 

    Question node configuration:
    Variable Global.Name, Global.Email, Global.Phone configured with:
    Save as user's entire response
    Global scope (any topic can access)
    External sources can set values ✅

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 876

#2
Vish WR Profile Picture

Vish WR 327

#3
Haque Profile Picture

Haque 289

Last 30 days Overall leaderboard