web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Experimental Features
Unanswered

Trying to update a lookup value through a canvas app using pcf

(4) ShareShare
ReportReport
Posted on by 17
Hello everyone

I am developping a canvas app to be able to show and edit a subgrid of records. For this I am developping a pcf using some datasets as input as I was not satisfied with the editable grid. 

I am then trying to update the record whenever a cell value changes in my subgrid and this works fine for every record type except for lookup values.I always get the following error: 

"Network error when using Patch function: Value must be a data entity record".

I have tried making a hardcoded lookup object myself, I have tried passing a data record directly, I have tried using record.getNamedReference() and passing that along, all without succes.

Below some examples of code I have tried: 

 
 
 
I know this is an experimental feature but there is documentation for it so I was hoping to get it working but to no avail.
https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/entityrecord/setvalue
https://learn.microsoft.com/en-us/power-apps/developer/component-framework/reference/entityrecord/save.

Has anyone run into this problem before and get it working?

Kind regards
A Power apps developer
 
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    52,851 Super User 2025 Season 2 on at
    Trying to update a lookup value through a canvas app using pcf
     
    I am having a hard time reading your code there so I apologize, so I want to ask a question.
     
    Are you trying to set a value that you will make available to your canvas app where it then uses a Patch, or are you actually trying to update the value in your PCF.
     
    I apologize I just want to make sure.
     
    Either way, you have to bind it to an actual record reference, not just pass in the GUID.
     
    You can see the Entity reference in the documentation stated. I apologize I truly cannot barely see what you have, my eyes are not that great atm.
     
    But you should use
    -Create an entity reference
    myReference {
       entityType: "add logical name here",
      name: "the display name here",
      id: "the guid you are using"
    }
     
    Then you use your setValue or updateValue as("use_logical_name_of_lookup_column", myReference);
     
    make sure to define myReference as a param type or whatever you are using.
     
     
    If these suggestions help resolve your issue, Please consider Marking the answer as such and also maybe a like.

    Thank you!
    Sincerely, Michael Gernaey
  • CU24110825-1 Profile Picture
    17 on at
    Trying to update a lookup value through a canvas app using pcf
    @Michael E. Gernaey Thank you for your answer

    I am trying to update the value directly in my PCF and then save the changes to that record.

    I have tried binding it to an actual entityReference.

    My apologies for the bad screenshot of the code. This is an example of how I try setting the value but without succes.



    I have also tried this approach but no success either. 


    If you have a working example, could you show me or tell me where I am going wrong?

    Kind regards

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

Coming soon: forum hierarchy changes

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 803 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 314 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 253 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics