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 variables from...
Copilot Studio
Answered

Passing variables from PVA in Teams to Power Automate

(0) ShareShare
ReportReport
Posted on by 57

Do we have the ability to pass variables from a PVA in Teams to "Call and action" Power Automate?  Or is this version in Teams a very basic BOT?

I have the same question (0)
  • gmurnock Profile Picture
    57 on at

    Guess I should elaborate more.  Do we have the ability to access the logged in user, User(), function from 365?  Seems crazy to have a user type in their name and email and other information when I can get it from their AzureActiveDirectory login.  Also asking the user questions in the BOT to just re-ask the same question in power Automate is NOT a very good UX.

  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hello @gmurnock 

     

    You can use the authentication, to get user details. Which can be passed to power automate, 

    than you can use a get user action to get all the details for the user:

    https://docs.microsoft.com/en-us/power-virtual-agents/advanced-end-user-authentication

  • micchow Profile Picture
    Microsoft Employee on at

    Hi Jcook, for bots created in PVA Teams app, you get the end user's name and ID directly because the authentication is set to 'Only for Teams' by default:

    https://docs.microsoft.com/en-us/power-virtual-agents/advanced-end-user-authentication

     

    For email, you could use the ID and call a PAuto flow with Office 365 connector to retrieve it. 

  • Verified answer
    Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hi @gmurnock 

     

    Here is a quick demo on how to achieve this:

     

    First make sure your authentication is set to "Only for Teams"

    Jcook_0-1603813221000.png

     

    Now inside a Topic, you want to call an action, and create a Flow. In the Flow you want to have an Input for the User Display name

    Jcook_1-1603813463930.png

     

    Next use a 'Search for users' action, and pass in the User input

    Jcook_2-1603813532170.png

     

    The outputs of this action are an array which makes it hard to pass back into PVA or any other system. So to get around this, add a 'Get user profile' action and use the first() expression to only take the first 'UserPrincipalName' from the 'Search for users' action

    Here is my expression:

    first(outputs('Search_for_users_(V2)')?['body/value'])?['UserPrincipalName']

    GetUserProfile.png

     

    Now we have all the users details, I am passing some info back to PVA to test:

    PVA-Outputs.png

     

    Save, and go back to the PVA canvas, next add an Action and select the Flow you created.

    For the User input, select 'bot.UserDisplayName' this is available to us from the Authentication we set above. 

    PVA-ActionFlow.png

     

    Next I am adding a Message block, to test out the Flow.

    PVA-ShowMessageUserDetails.png

     

    Testing the Bot:

    Success-Run.png

     

  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hi @gmurnock 

     

    Could you let us know if you issue has been solved?

     

    Please try my solution above. Thanks

  • k1ng Profile Picture
    50 on at

    So you mean @Jcook that you can't pass an array back to pva?  "The outputs of this action are an array which makes it hard to pass back into PVA or any other system.

     

    I am trying to make a simple search address book from o365 but I wanted to have multiple queries...?  

  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hi @k1ng 

    That’s a great use case!


    You can pass multiple fields to PVA for a multi query in the O365 Users connector. What I was saying is that you cannot pass back a data type of Array. In my solution above I explain the workaround to pass an Array type, by converting the array to a string.

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 619

#2
chiaraalina Profile Picture

chiaraalina 163 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 147

Last 30 days Overall leaderboard