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 / How to update the Look...
Power Apps
Answered

How to update the LookUp field of a SharePoint list in the Edit Form based on the selection of another ComboBox

(0) ShareShare
ReportReport
Posted on by 68

Hi All,

 

I have 2 lists named Projects and Product_Suites.

  • The Projects list contain Name, Description and ofcourse an ID column.
  • In the Product_Suites list, I have linked the Projects list columns as LookUp columns. The main LookUp column ProjectID displays the ID of the Projects list (Since its a main lookup column, when clicking an ID of ProjectID lookup column, it will navigate to the corresponding record of the Projects list.

In PowerApps, I have an EditForm for the Product_Suites list.  I have set the DisplayMode of the ProjectID_DataCard as View because the end user won't be able to set the ProjectID as it will display the ID only and not the name.

So, I have added a custom data card (ProjectName_DataCard) in which I have used a ComboBox to display the Project name values. 

 

So when a user selects a Project name in the custom ProjectName_DataCard, I want to update the Selected Item of the ComboBox present in the ProjectID_DataCard. So that when Submiting the form, the ProjectID will be updated in the SharePoint. 

 

Items property of ProjIDComboBox in the ProjectID_DataCard: This code was automatically set when EditForm is created.

Choices([@Product_Suites].ProjectID)

 

Items property of the ComboBox1 in the custom ProjectName_DataCard: The Projects list only contains all the Project names.

Projects.'Name (Title)'

 

I have tried to set the DefaultSelectedItems property of the ComboBox in the ProjectID_DataCard as below code. 

Since the ProjectID is a LookUp column in the SharePoint list and it links to the corresponding record of the Projects list, the return type is of a record, hence I passed the corresponding record in the code that I tried below. 

If(
 ComboBox1.Selected.'Name (Title)' in Projects.'Name (Title)', 
 LookUp(
 Projects,
 'Name (Title)' = ComboBox1.Selected.'Name (Title)'
 ),
 Parent.Default
)

 But the ProjectID is not getting updated in the ProjIDComboBox. 

 

So can anyone let me know how to set the ProjectID based on the selection in the ComboBox1 of the custom ProjectName_DataCard?

Categories:
  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @sgokul95 ,

    DefaultSelectedItems should be (I am assuming a few names here, but you will get the idea of the syntax required)

    If(
     ComboBox1.Selected.'Name (Title)' in Projects.'Name (Title)', 
     {
     Value: 
     LookUp(
     Projects,
     'Name (Title)' = ComboBox1.Selected.'Name (Title)'
     ).'Name (Title)'
     },
     {Value:ThsItem.ProjectID}
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

  • sgokul95 Profile Picture
    68 on at

    Hi @WarrenBelz ,

     

    Thanks for your quick response. I have tried the suggested code and modified it as below such that the ProjectID is set as the Value instead of the Name.

     

    If(
     ComboBox1.Selected.'Name (Title)' in Projects.'Name (Title)', 
     {
     Value: 
     LookUp(
     Projects,
     'Name (Title)' = ComboBox1.Selected.'Name (Title)'
     ).ID
     },
     {Value:ThisItem.ProjectID}
    )

     

    sgokul95_0-1636691734012.png

     

    Now the value is displayed correctly in the ProjectID field. But the thing is that, it is not getting saved in the SharePoint when invoking the SubmitForm function. Here is the Update property of the ProjectID_DataCard. 

     

    ProjIDComboBox.Selected

     

  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at

    Hi @sgokul95 ,

    Lookup columns . . .they will cause you more unnecessary grief than almost any other type (other then Person fields) - I have have not used them for many years - you might be interested in this blog of mine.

    I am not sure why you are displaying the ID instead of the field name in the Items, however your Data Card Update will be something like

    {
     Value:ComboBox1.Selected.'Name (Title)',
     Id:
     LookUp(
     Projects,
     'Name (Title)' = ComboBox1.Selected.'Name (Title)'
     ).ID
    }

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • ice1234 Profile Picture
    55 on at

    Hi all,

     

    I have a similar problem. My lookup column returns blank when I hit submitform. Does any one have a solution to this? 🙂 

  • id013 Profile Picture
    30 on at

    I implemented the solution from here:

    https://powerusers.microsoft.com/t5/Building-Power-Apps/LookUp-Field-not-updating-i-n-sharepoint-list/td-p/375680

     

    but I'm finding that if I use that update code, the required field doesn't work correctly. ie the field never shows up as required.

  • JacobCats Profile Picture
    5 on at

    Thank you for this helpful and clear information, it saved me a lot of time.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard