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?
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.
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...?
Hi @gmurnock
Could you let us know if you issue has been solved?
Please try my solution above. Thanks
Hi @gmurnock
Here is a quick demo on how to achieve this:
First make sure your authentication is set to "Only for Teams"
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
Next use a 'Search for users' action, and pass in the User input
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']
Now we have all the users details, I am passing some info back to PVA to test:
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.
Next I am adding a Message block, to test out the Flow.
Testing the Bot:
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.
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
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.