PowerApps Cascading Dropdown

Introduction

 
In this article, we will see how to implement a cascading dropdown in PowerApps and save it back to the SharePoint list.
 
We will create an example for employee information and we will have two dropdowns: country and state. We want to filter state dropdown based on the country dropdown selection. Let's start with step-by-step implementation.
 

Demo

 
Create SharePoint lists as below:
  • Create a list called Country with the below field:
PowerApps Cascading Dropdown 
  • Create a list called State with the below fields:
State List
  •  Set the Country Lookup column as shown below:
PowerApps Cascading Dropdown
  • Create a list called Employees with the below fields:
Employees 
  • Set the Country Lookup as created above in State List.
  • Set the State Lookup as below:
PowerApps Cascading Dropdown
 
Let's start the PowerApps Implementation step by step:
  • Move to the PowerApps
  • Go to the Create > Canvas app from blank
  • Give App name and select format
 Now we will add the required controls (Labels, Dropdowns, and button) in our PowerApps as shown below:
 
Final Structure
 
Add the required Data sources as below:
  • Go to the View on top ribbon > Select Data source > Search SharePoint > Add connection > Connect to the SharePoint Site > Select lists (Country ,State and Employees).
Map data source with Dropdowns:
  • Select Country Dropdown - Set Items Property as shown below:
PowerApps Cascading Dropdown
  • Select State Dropdown - Set Items Property as shown below:

    PowerApps Cascading Dropdown
Now we will save the record in SharePoint list as shown below.
 
Select the Submit button - Set OnSelect Property as shown below:
  1. Patch(  
  2.     Employees,  
  3.     Defaults(Employees),  
  4.     {  
  5.         Title: "test",  
  6.         Country: {  
  7.             '@odata.type'"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",  
  8.             Id: ddCountry.Selected.ID,  
  9.             Value: ddCountry.Selected.Title  
  10.         },  
  11.         State: {  
  12.             '@odata.type'"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",  
  13.             Id: ddState.Selected.ID,  
  14.             Value: ddState.Selected.Name  
  15.         }  
  16.     }  
  17. );  
  18. Notify("Record Saved Successfully!!!");  
Refer to this article to learn how to use the Patch function in PowerApps.
 
Output
 
PowerApps Cascading Dropdown
 

Summary

 
In this article, we have seen how to create a cascading dropdown in PowerApps with a demo application. 
 
I hope you like this article, share it with others. Give your valuable feedback and suggestions in the comments section below. 
 
Sharing is caring!!!