Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - General
Answered

Call In Action with Switch Statement

(0) ShareShare
ReportReport
Posted on by 3,263

Hi there,

Sorry very new to PVA. I was wondering if this is possible?

 

I would like to show to my user a menu with some reports to choose, and based in the answer selected call a flow and let the flow to filter my Share Point list and return the values as a table or something easy to ready.

 

The flow part I am confident how to do it. I am lost for the Call Action or how to pass the variable selected. and Also how to return the values to my user.

 

Here is an idea.

 

Than in advance for any help.

 

regards.

 

sajarac_0-1651492736726.png

 

 

 

 

Categories:
  • SupportBryn Profile Picture
    Microsoft Employee on at
    Re: Call In Action with Switch Statement

    Happy to help @sajarac! If that solves everything, feel free to mark it as the solution, so other people with similar questions can have an easier time finding it. 

     

    Thank you for using Microsoft Power Platform Communities!
    Bryn Baker
    Support Engineer
    Microsoft Power Platform
    If this post helps, then please consider accepting it as the solution to help other members find it more quickly! Have a great day!

  • Sajarac Profile Picture
    3,263 on at
    Re: Call In Action with Switch Statement

    Wow, Thank you very much @SupportBryn , for this great explanation.

    🙂

  • Verified answer
    SupportBryn Profile Picture
    Microsoft Employee on at
    Re: Call In Action with Switch Statement

    Hi @sajarac,

     

    So, there's a few steps that would be required in order to do this. First, to accomplish creating and populating the varReportSelected, you'll need to create a question that asks them that. You'll need to add each of those as an option to a multiple choice question, and then fill out the "Save response as" section at the bottom of the question card, which will also allow you to name the variable varReportSelected.

     

    Once you do that, you'll need to create the flow, by clicking the + icon underneath the question card that appears when hovering there, and selecting "Call Action" -> "Create a Flow". This will create a new Cloud Flow in the proper solution to match up with your PVA Bot. Once within the Flow, you can open up the Power Virtual Agents card, like so:

     

    Screenshot 2022-04-13 115102 - Copy.png

     

    and change the input type to match up with your variable (in this instance, most likely text). Then create the rest of the Flow as you see fit, returning the variables into your bot using the Return Value(s) to Power Virtual Agents card at the bottom of the flow, which allows for multiple inputs. You can then take those named returned variables and feed them into an output to your User.

     

    Something to keep in mind is, if the number of output values may differ between the different types of reports, they will not easily line up with a single Flow's return values. If that is the case, and you may be returning, say, 1 number and 3 text variables for one report, and then 3 number variables for a different report, you may instead want to create an individual Flow for each type of report, and instead of putting the variable from PVA into the Flow, have a conditional branch within PVA itself in order to make sure that your output message is receiving data that does not break it, and your Flow can then have more specialized return types depending on the exact data Power Automate is retrieving. 

     

    A couple of clarification points:

     

    • Using the "Create a Flow" command from the Call Action menu will not automatically place that Flow in where you selected the action. Upon finishing and naming the Flow, you will have to go back to that place underneath the question card and select the named Flow from the Call Action menu.
    • Flows created in Power Automate that were not created from the "Create a Flow" action in the Call Action menu will not show up in your list of Actions in Call Action
    • Power Automate and Power Virtual Agents are separated applications, so there are no natively shared variables/inputs. Any information that would be required to find a specific report, such as the ID or authentication profile of the specific user conversing with the bot, will also need to be added as inputs into the Flow in order to properly populate whatever request the Flow will process.

     

    As for displaying the variables to the user, once all the variables you need are populated from the Flow, you can simply use this button: 

    Screenshot 2022-05-02 115909.png

     

    to add the dynamic content of the variable to a given message box.

     

    Hope this helps!

    Thank you for using Microsoft Power Platform Communities!
    Bryn Baker
    Support Engineer
    Microsoft Power Platform
    If this post helps, then please consider accepting it as the solution to help other members find it more quickly! Have a great day!

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

Announcing the Engage with the Community forum!

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Copilot Studio - General

#1
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 76

#2
Pablo Roldan Profile Picture

Pablo Roldan 61

#3
stampcoin Profile Picture

stampcoin 10

Overall leaderboard