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 / Lookup Field not Savin...
Power Apps
Answered

Lookup Field not Saving - Part II

(0) ShareShare
ReportReport
Posted on by 15

I have a table in CDS that I'm building a Power App form to insert into. One of the fields is a Lookup combo box pulling data from another CDS table. Initially everything worked fine on the form, but when I click submit, this field does not save. I did some research and found posts that appeared to address the issue:

 

Lookup Field not Saving 

 

The recommended solution is to add the following text to the update field:

 

If(

   !IsBlank("ProductionPlantValue5),

   (

      {

         '@odata.type': "Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",

         Id:"ProductionPlantValue5.Selected.ID,

         Value: "ProductionPlantValue5.Selected.Production_x0020_Plant1

      }

   )

)

 

My values are as follows:

 

Control Name: DataCardValue13

Column Value to Reference Display Name: Name

Column Value to Reference Data Field Name: cr5ed_name

 

If(
!IsBlank(DataCardValue13),
(
{
'@odata.type': "Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id:DataCardValue13.Selected.cr5ed_id,
Value: DataCardValue13.Selected.cr5ed_name
}
)

)

 

All variations of this statement throw an error and no record is created at all. I am not sure what to put in place of the "ID" listed in the Id line of the snippet above. The table I am referencing was loaded from excel, so the unique identifier column appears not to have been populated and has only blank values. I created a separate unique key and referenced that (cr5ed_id) but that is not working either. 

 

 @WarrenBelz helped answer the original post by @Bartron . Any insight you guys can offer would be highly appreciated! Thanks! 

 

  • EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Hi @Tim_RA,

    The sample code references SharePoint, but you are using Dataverse (formally CDS) right? To update a lookup you can simply refence the selected object and don't need to reference the exact physical column name. So far example:

    Patch(TableA, Defaults(TableA), {LookupColumn: DataCardValue13.Selected})

    instead of

    Patch(TableA, Defaults(TableA), {LookupColumn: DataCardValue13.Selected.cr5ed_id})

     Hope this helps!

  • Verified answer
    Tim_RA Profile Picture
    15 on at

    Thanks Everyone!

     

    I received a response from @WarrenBelz which solved the issue, so I will re-post here in case it helps others. There was no reason for me to use the lookup datatype and it was causing unnecessary complexity and headache.

     

    ----

     

    Hi Tim,

    The first thing you need to ask yourself is why are you using Lookup fields with Power Apps. You can do exactly the same lookup in Power Apps and write back to a Text field. I have a blog on data structure:

    https://www.practicalpowerapps.com/data/constructing-your-first-power-app-before-you-start/

    that may assist.

     

    Putting this aside, the pain you can cause for yourself comes from the fact that the field has two elements, neither of which belong to the list you are writing to. The Value is easy enough as you have selected this, but the Id is the ID (note case on both of these) of the item in the other list you are looking up, so unless you simply "leave alone" the control that Power Apps will build, you have to retrieve the Id from the other list. My example posted was when you have used the other list as the Items of a combo box (so both values will be there).

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard