To pass data from a Power Pages portal page (such as a Case Id) to the Power Pages copilot agent (particularly the built-in agent), currently, direct global variable or context passing is not natively supported for built-in agents like it is for custom embedded agents. With custom agents, you can use methods like `WebChat.createStore()` and `WebChat.renderWebChat()` to inject data from your portal into the agent’s session context.
For built-in agents enabled directly via the Power Pages platform, Microsoft does not provide direct documentation or API support to pass local page data (such as query strings or session variables) into the agent context during an active chat. This is a common request and worth raising on the community or Ideas forum for feature support.
Potential workarounds until this feature is released:
- You may consider embedding a custom agent using the WebChat framework, even in Power Pages, which will allow you to manipulate the store and pass initial data when the chat loads.
- Alternatively, store the required data (like Case Id) in Dataverse and configure your agent to fetch it at session start, although this is less dynamic than passing it directly from the page context.
I hope this answer will help you
Best Regards,
Jerald Felix