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 / Power Apps / Pass Canvas App values...
Power Apps
Answered

Pass Canvas App values to a Flow using a button

(0) ShareShare
ReportReport
Posted on by 260

Hi all

 

Trawling through countless posts regarding the subject, I am yet to find a solution for my task, hoping someone here can assist.

 

I simply want to create a new SharePoint list item based on the values of two TextInputs in a canvas app.

 

I attempt to pass the values to Power Automate with the following code...

 

ClearCollect(colNewRequest, 
{Name: TextInput1.Text,
Code: TextInput2.Text});

Set(varFlowData, JSON(colNewRequest));

'PowerAppName'.Run(varFlowData);

 

 

In Power Automate, I have a Parse JSON step as well as an email step for testing.

 

The resulting email looks like this....

 

 

{"Sendanemailnotification(V3)_Body":"[{\"Code\":\"VALUE_1\",\"Name\":\"VALUE_2\"}]"}

 

 

I want to create a new SharePoint List item using the two values "VALUE_1" and "VALUE_2".

 

How can I extract "VALUE_1" and "VALUE_2" from the "Parse JSON" step, so that I can use these values to create the SharePoint List item?

 

Thanks for any help!

Categories:
I have the same question (0)
  • Verified answer
    mmollet Profile Picture
    3,187 on at

    This could all be done very easily in Power Apps without a flow. In case you were just trying to learn flow a bit better then here is an explanation:

    First create your flow, make it use the Power Apps trigger. 

    Second use the Init variable step to create all the variables you want to get from Power Apps. If you want the users full name and email and some choice from a dropdown then make 3 string variables and for their values put ask in Power Apps. Once this part is done you can save the flow and go back to Power Apps. 

    Now what you want to do is import that flow to the Power App. This will give you access to the fields the flow is expecting and once you pass the correct values the flow can be executed. Here is some example sentax assuming 3 string variables as mentioned above.

    YourFlowName.Run(User().FullName, User().Email, Dropdown1_1.Selected.SomeField)

    Once this is done you should execute the flow and make sure it is getting the values from Power Apps. If it is then you are ready to start building out your flow. 

     

    For Parse JSON you will need to get the proper schema first. Once that is done you should have a starting string for the Content and the Schema filled out in the Parse JSON function. Once this is done you will have an array of whatever you passed in using the JSON function in Power Apps. You can use this as the Apply to each input or whatever you need at this point. 

     

    1. Save Variables from Power Apps
    2. Parse JSON
    3. Loop through JSON array and SP Add Item for each one. 
    4. At end send your email with the desired content. 
  • fnanfne Profile Picture
    260 on at

    Hi thanks for the reply.

     

    I'm not following you 100%.

     

    I have tried something like this before (adding parameters inside the brackets) but were not successful.

     

    As instructed, I've created a new flow (it has to be an "Instant" flow, in order to use the "PowerApps" trigger) and created the required Initialize Variables, only two of them.

     

    Back in PowerApps, I then added the following code to a button in the app

     

    'PowerAutomateFlowName'.Run(TextInput1.Text, TextInput2.Text)

     

    However, I get an error...

     

    "Invalid number of arguments: received 2, expected 0."

     

    Any ideas?

  • mmollet Profile Picture
    3,187 on at

    I am assuming that you imported/connected the flow to the Power App as well. After you type FlowName.Run( the intellisense should tell you what the flow is expecting from PowerApps. If this doesnt pop up there may be something wrong with the connection etc. 

     

    Screenshot 2023-05-16 at 9.40.13 AM.png

     

  • fnanfne Profile Picture
    260 on at

    Yes of course, I omitted that detail.

     

    I have imported the flow to the PowerApp. I can see the flow in the powerapp when I start typing the name of the flow, so that confirm to me that the flow was added successfully to the app.

     

    I don't however, see any intellisense when I try to type.

     

    I have also tried to create the flow indirectly.

  • fnanfne Profile Picture
    260 on at

    This is the flow, can you confirm the flow is correct?

     

    flow.png

  • fnanfne Profile Picture
    260 on at

    My bad!

     

    I forgot to add in the values for those variables.

     

    It's now working thanks!

     

    I can now continue building the rest of my flow, thanks again!

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 > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard