Skip to main content

Notifications

Copilot Studio - General
Unanswered

Variables from Copilot Studio to Power Apps

Posted on by 2
I have a Copilot studio bot that I need to allow users to choose to navigate to a Power Apps supporting application. I need to pass variables to the Power App so that the data is pre-filtered. I know that I can pass variables to Power Automate, which is great, but I cannot then pass from Power Automate to Power Apps because I cannot use the "respond to Power Apps" node since the app did not trigger the flow to begin with. Any guidance would be appreciated!
Categories:
  • Suggested answer
    Vinoth Selvam Profile Picture
    Vinoth Selvam 541 on at
    Variables from Copilot Studio to Power Apps
     
    You can still use Power Automate flow to achieve this.
    1. User interacts with Copilot, and based on their inputs, Power Automate performs the necessary actions.
    2. At the end of the Power Automate flow, construct the Power Apps URL with pre-filtering parameters.
    3. Return this URL to Copilot or navigate directly using a link so that when the user clicks the link, the filtered Power Apps page opens.
    More details:
    • Use Power Automate to Call Power Apps Directly:
      After performing your logic inside Power Automate, you can append the parameters to the Power Apps URL. Power Apps allows passing parameters via the URL, which can then be read inside the app to pre-filter the data.

      https://apps.powerapps.com/play/{AppID}?param1=value1&param2=value2
    • Extract Parameters Inside Power Apps:
      Once the Power Apps application is launched with the parameters in the URL, use Power Apps functions like Param() to read the parameters. For example: Param("param1")

    • Flow Execution:
      Inside the Copilot bot, you can pass the parameters from Power Automate to Power Apps by constructing the URL with these parameters and triggering it as part of the response to the user.

     
    Thanks.
  • Suggested answer
    SaiRT14 Profile Picture
    SaiRT14 336 on at
    Variables from Copilot Studio to Power Apps
    Pls check below steps:
     
    • In Copilot Studio, when the user interacts with the bot and selects an option, you can trigger a Power Automate flow to process the data and generate the necessary filtering information (e.g., IDs, filters, etc.).
    • Instead of trying to pass the data directly back to Power Apps, generate a URL that includes the variables as query string parameters.
      • https://apps.powerapps.com/play/e1234567-89ab-4cde-f012-3456789abcdef?FilterID=123&Status=Active
         
    • In Power Automate, after processing the variables or data from Copilot, construct the Power Apps URL with the necessary parameters:
      • https://apps.powerapps.com/play/{AppID}?FilterID={varID}&Status={varStatus}
         
    • Once the URL is constructed, have the Power Automate flow return the URL back to the Copilot bot, where users can click on it to navigate to the Power Apps app with the pre-filtered data.
    • In Power Apps, you can use the Param() function to capture the query string parameters passed in the URL.
      • // Capture the parameters passed in the URL
        Set(FilterID, Param("FilterID"));
        Set(Status, Param("Status"));
        // Use these parameters to filter your data
        Filter(DataSource, ID = FilterID && StatusColumn = Status)
    • When users click on the URL returned by the Copilot bot, they will be redirected to the Power Apps app, and the app will automatically pre-filter the data based on the parameters in the URL.

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

September 2024 Newsletter…

September 2024 Community Newsletter…

Community Update Sept 16…

Power Platform Community Update…

Tuesday Tip #2 Global Search…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,076

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,535

Leaderboard