Hello Everyone !!
In this blog, we will see how we can get custom lists & respective views using PowerApps canvas app. Most of the time while building canvas app using SharePoint we need to populate custom list of a site. And also need to populate respective views of that list. We will go through step by step, how we can achieve this.
This whole solution is divided into two major parts.
1. Create canvas pp.
2. Call/build a power automate
First we will create a simple canvas app to facilitate our get action. Below is the screen shot of my canvas app.
In my canvas app, it is very clear that Text box and drop downs are used. Fetch list and view button will populate the data in respective drop downs.
Now we will trigger power automate from button click. If you don’t know how do it, please go through this blog. Before we dive into data binding of drop downs and button click events. I would discuss about our Power Automate part.
Call Power Automate
In order to call power automate part we need to build it first. Let’s start this. Here I had created two flows.
- PowerApps Get Lists
- Get Views
PowerApps Get Lists
Let’s discuss each in details.
Get Lists – Site Address value will be input by user in power apps.
Initialize Variable – Provide a name and data type for the initialised variable.
Apply to each – Remember to add “,” before display name of value in append to string variable.
Respond to a PowerApp or flow – We will create “ListName” string output to store all the lists name separate by comma.
Here all the steps for this flow are almost same as of the above flow. Refer below picture for the reference. There will be slight difference in Get list Views and Apply to each step which is shown in picture.
After doing the above steps, come back to power apps studio. Now we will write click event on buttons and do the data binding.
Fetch List Button -> OnSelect -> Set(listdetails,PowerAppsGetLists.Run(TextInput1.Text))
Select List Dropdown -> Items -> Split(PlainText(listdetails.listname),",")
Fetch View Button -> OnSelect -> Set(viewdetails,GetViews.Run(TextInput1.Text,Dropdown1.Selected.Result))
Select View Dropdown -> Items -> Split(PlainText(viewdetails.nameview),",")
Voila…..Now you can test your app. You can always refer this link for power automate related things.
Hope you will like this post. Subscribe our site, if you really want to discover more stuffs related to power platform. In our next blog we will see to export the view on a button click. Stay tuned guys..!!
If you have questions related to PowerApps or Power Automate please feel free to comment or contact us