cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

PowerApp Button pass 2 seperate parameters to a Flow for Powershell

I am trying to understand how to pass 2 seperate parameters ( email addresses for example ) from a powerapps button to a flow.  I have seen how to use Compose in Flow to "Ouput" all emails to the one Output, but I need 2 seperate variables that I can use in my flow to create a file and run a powershell script.

 

For Example:

 

I need to run a Set-MailboxPermission -identity User1 -Owner Mgr1

 

I need seperate variables for User1 and Mgr1 to be passed from PowerApps and how I would write that in Flow

 

I understand the concept of

 

PowerApps Button,Compose,CreateFile ( pshell command in here ), Send Email -- But this only allows 1 output to be passed using "Compose"

 

1) How would I write this in PowerApps

2) How would I write this in Flow

 

Thanks in advance!

 

Steve

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Stevo,

 

If I understand you correctly, create a flow and use PowerApps as a trigger. Initialize a variable and give it a meaningful name as this is what you will be asked for in PowerApps as an argument.

Init var.png

 

 

Rename.png

 

In the value, tell it to 'ask in PowerApps'.

ask.png

 

When this flow is called from PowerApps, it will ask you to pass the parameters.

call flow.png

 

 

 

 

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Anyone?

I take it you want to pass two or more items with a flow.  Not sure where you are storing the data, but when I do this in sharepoint I use the ForAll() function. It means there is a seperate Flow for each one

Anonymous
Not applicable

Hi, thanks for responding. I am trying to pass 2 variables from a Single PowerApp button but have them have their own unique variable in flow. This is the formula on the PowerApp, but it isn't working and not even sure this is the correct procedure for passing 2 variables: MultiButton.Run(UpdateContext({User1:MainForm.Selected.UserPrincipalName,Mgr1:Office365Users.Manager(MainForm.Selected.UserPrincipalName)})) This is the flow the button connects to. It takes the input from the button and then creates a PowerShell file on a server with the command that I want to run, this is an example: PowerApps-->Compose*Inputs-->​Compose_Inputs×-->Create file: *Folder path \\Server\upload *File name Pshell.ps1 *File content Set-ADPermission Output -Owner Output The "**Output**" is the 1 variable of both pieces of data from the PowerApp. The example below is how I would like it to be: Set-ADPermission User1 -Owner Mgr1 Any ideas? Steve
Anonymous
Not applicable

Anyone know how this could be done?  is this a combination of "Split" and "variable" expressions inside of flow?

Hello Stevo,

 

If I understand you correctly, create a flow and use PowerApps as a trigger. Initialize a variable and give it a meaningful name as this is what you will be asked for in PowerApps as an argument.

Init var.png

 

 

Rename.png

 

In the value, tell it to 'ask in PowerApps'.

ask.png

 

When this flow is called from PowerApps, it will ask you to pass the parameters.

call flow.png

 

 

 

 

Anonymous
Not applicable

Hey dawidvh , thanks for the reply!  I had figured it out using compose --> input and asking in powerapps  ( I was over thinking it with expressions).  I like your idea for using "Initialize Variable" more though, thank you for that.

 

So now I can pass 2 parameters ( or more )  directly from my powerapp to the flow which will create a ps1 and run the script.

 

In case anyone is looking to get something similiar to this done, there was a post on it by SergeLuca I believe.  It all comes down to the flow:

 

PowerApps Button-->Initialize Variable-->Initialize Variable1-->

Create File ( Location: OnPrem Data Gateway, Name: pshell.ps1, content: Set-AdPermission -Identity 'Initialize Variable' -owner Initialize Variable1) --> Email out status--> Generate a log or whatever you like.

 

The key to do this is creating that watcher script on a server that watches for ps1 files created in a specific share ( the onprem gateway locaion).  This would be a constant pshell window open with a keep alive script.   Once pshell.ps1 is created it sees the file, then it does an invoke-expression on the ps1 whch runs the command.  This can also be done with scheduled Tasks, works great!!

 

Thanks again dawidvh!

 

Stevo

I am having problems doing this similarly but to a Flow for an HTTP web service.  I created 3 variables with Initialize variable which connect to parameters from text input in the PowerApp.  But when I create a button in the PowerApp to call the flow, it just says Run, and does not show to enter the 3 parameters.  Why is that?

Attached, please find the Flow that I created.  

Hi,

 

Can you please tell me that How to add "testforstevo" function ?

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,601)