Do you know how to add a SharePoint lookup column in Power Apps? If not, no need to worry!
This Power Apps tutorial will teach all the information about the Power Apps lookup SharePoint list. Here, we will discuss how to add a SharePoint lookup column in Power Apps using two ways. Such as:
- Power Apps Lookup SharePoint List Using Customized Forms
- Power Apps Lookup SharePoint List Using Dropdown Control
Power Apps Lookup SharePoint List
Let’s see how to add a SharePoint lookup list lookup column in Power Apps using two different examples.
Example – 1:
I have two SharePoint Online lists, i.e., [“Employee Onboarding” and “Employee Departements] and the first SharePoint list contains the below fields.
Column Name | Data Type |
Employee ID | It is a default single line of text |
Employee Name | A single line of text column |
A single line of text column | |
Gender | Choice |
Joining Date | Date and time |
Employee Department | A single line of text |
The second SharePoint list [Employee Departements] contains the fields as shown below.
Column Name | Data Type |
Employee Department | It is a default single line of text column |
Department Manager | A single line of text |
Refer to the below image:
In Power Apps, there is a SharePoint list customized form, now I want to add a SharePoint lookup column in the dropdown control as in the screenshot below.
To work around this example, follow the below-mentioned steps. Such as:
1. Open respective SharePoint Online list [Employee Onboarding] -> Expand the Integrate dropdown, select Power Apps, and click on the Customize forms as shown below.
2. When you click on the Customize forms, the Powerapps form will appear with SharePoint list fields.
3. Also, you can add or remove the unwanted columns from the Edit fields section (Properties -> Edit fields) as shown below.
4. Here, Since the “Employee Department” field is a Text data type. Now, I want to make this field as a Lookup field by using another List column from the “Employee Department list”.
5. To make the field as a Lookup field in PowerApps, select the Employee Department Data card and unlock it (Advanced -> Unlock). Once it unlocks, just remove or delete that Data card value text box.
6. Now insert a Dropdown control (Insert -> Input -> Dropdown) inside the Employee Department Data card.
7. Just drag and resize the dropdown control as per your need. If you select the dropdown control, then you can see its Items property as DropDownSample. Also, you can rename the Dropdown control. By default, the name will be Dropdown1.
8. Now, we need to add another SharePoint list, i.e., [Employee Departments] to the Power Apps like below.
9. Next, select the Dropdown control and set its Items property to the code below.
Items = 'Employee Departments'.Title
Where,
- ‘Employee Departments’ = Second SharePoint Online List
- Title = SharePoint List Text Field
10. Now, in the Powerapps Customize form, the Dropdown control is to get all the options in the Title field [From the Employee Departments List].
11. Now we will talk about the errors that appear in the “Employee Department Data Card”. The errors are appearing because of the Dropdown Data card value.
12. As we have changed the data card value from the text box to the dropdown box, that’s why we need to pass the dropdown card value to the Employee Department Data Card’s Update property as well as the Y property (Height property).
Update = drp_Depatments. Selected.Title
Y = drp_Depatments. Height
Where,
- drp_Depatments = Power Apps Dropdown Value
13. Once your app is ready, Save, Publish, and Preview the app. Whenever the user clicks on the dropdown control, it will display all the lookup column values as shown below.
This is all about the Power Apps lookup SharePoint list using customized forms.
Power Apps Lookup SharePoint List Using Dropdown Control
I have a SharePoint Online List, i.e., [Patient Tracker]. This list contains the below fields.
Column Name | Data Type |
Patient ID | This is a default single line of text; I just renamed it as “Patient ID” |
Name | A single line of text |
Date Of Birth | Date and time |
Disease | Disease |
This SharePoint lookup column [Disease] is added from another SharePoint source list named “Diseases List“. This list contains the below fields.
Column Name | Data Type |
Disease | It is a default single line of text, I just renamed it as “Disease” |
Doctor’s Name | A single line of text |
Doctor’s Experience | Number |
Doctor’s Fees | Currency |
Refer to the below screenshot:
In Power Apps, a “New Form” is connected to the SharePoint Online list. This form contains a Dropdown field called Disease [Lookup Column], having values like Diarrhea, Influenza, Lyme disease, etc.
When a user selects any value from the dropdown control, the text inputs will display the disease-related doctor’s name and fees based on the selected disease.
To achieve the above example, follow the below-mentioned steps. Such as:
1. Create Power Apps Canvas app -> Connect to the SharePoint Online list [Patient Tracker]. Once the SharePoint list is added, it will appear under the Data section below.
2. Insert an Edit form [frm_NewPatient] -> set its DataSource as:
DataSurce = 'Patient Tracker'
Where,
- ‘Patient Tracker’ = SharePoint Online List
3. To display the SharePoint list fields in the form control, click the Edit fields option and add fields as needed.
4. To get the Edit Form to a New form, just set the Default mode as “New” as in the screenshot below.
5. Insert a Text input [Textinput_Doctor’sName] control inside the form and set its Default property to the code below.
Default = LookUp(
'Patient Tracker',
Disease.Value = drp_Disesase.Selected.Value,
'Disease: Doctor''s Name'.Value
)
Where,
- LookUp() = This Power Apps LookUp() function is used to find a single record that matches one or more criteria
- ‘Patient Tracker’ = SharePoint Online List
- Disease.Value = SharePoint lookup field value
- drp_Disesase = Dropdown Control Name
- ‘Disease: Doctor”s Name’ = It is a SharePoint additional column from the source list
6. Then, insert another Text input control [Textinput_Doctor’sFees] -> Set its Default property as:
Default = LookUp(
'Diseases List',
Disease = drp_Disesase.Selected.Value,
'Doctor''s Fees'
)
Where,
- ‘Diseases List’ = SharePoint Source List
- Disease = SharePoint Lookup column
- ‘Doctor”s Fees’ = SharePoint Currency Field
7. Save, Publish, and Preview the app. If a user selects any value from the dropdown control, then text inputs will display the values based on the dropdown selected value, as shown below.
Conclusion
This Power Apps tutorial taught all the Power Apps lookup SharePoint list information. Here, we discussed how to add a SharePoint lookup column in Power Apps using two ways. Such as:
- Power Apps Lookup SharePoint List Using Customized Forms
- Power Apps Lookup SharePoint List Using Dropdown Control
You may also like:
- How to Set Default Selected Item in Power Apps Gallery?
- Power Apps Show Image from SharePoint List
- How to Create a Power Apps Canvas App From a Template?
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com
This works fine on a new selection, but the lookup field is blank on existing records. I tried substituting several other things, like “ThisItem.fieldname”, but get an error that the formula uses scope, which is not supported.
This article got me closer than anything else… trying to get the last hurdle.
What is the exact error message? Can you share?
How can I use this with Distinct?
I actually figured out my last question but I have ran into a strange issue. I have this working all fields are now submitting to my sharepoint list. Problem is, when I open the form back up to edit the data is not retained in the form….