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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / [custom page/fx] Why i...
Power Apps
Unanswered

[custom page/fx] Why is patching a record so ridiculously difficult?

(0) ShareShare
ReportReport
Posted on by

I honestly don't understand how MS made something that should be simple, so bloody difficult.

 

When I press a button I want to update a record. Param is received from a model driven app, the combox has the value (guid) I want to patch in a lookup field.

 

Patch( Cases,
LookUp( Cases, Case = Param("recordId") ), { Queue: ComboBox1.Selected.Queue } )

 Above is modified from MS' useless docs. I presume here that Cases have to be the table name, and Case the display name of the guid field (why the hell MS wants to use display names is beyond me...).

 

The above results in an utterly useless "guid values can only be compared to other guid values" error.

Categories:
I have the same question (0)
  • QuentinDURIEZ Profile Picture
    547 Moderator on at

    Hi,

    You can eventually use logicalname name instead of display names, this works the same way, display names can make it more easy to work with for someone who is form the dev world .


    Your error is caused because Param("recordId") will return a string value, since "Case" (or "caseid") is a GUID column type, you need to cast the Param return.

    To make it more readable, you can also use the keywork "As" beside your source declaration, this can make it simple to understand how this work.

    In result, your formula should looks like this : 

    Patch( Cases,
    LookUp( Cases As case, case.Case = GUID(Param("recordId")) ), { Queue: ComboBox1.Selected.Queue } )

     
    Regards,

     

  • NoName404 Profile Picture
    on at

    Thanks. That solved one error but now it whines that the Queue is a record type while the combobox value is a guid. Which obviously it is because Dataverse WANTS you to set a GUID but of course powerfx apparently has its own special way of doing things... not documented of course. That is how MS roles.

  • QuentinDURIEZ Profile Picture
    547 Moderator on at

    Hi,

    Patch( Cases,
    LookUp( Cases As case, case.Case = GUID(Param("recordId")) ), { Queue: ComboBox1.Selected} )


    ComboBox1.Selected represents the Queue record, when ComboBox1.Selected.Queue represents the unique ID of selected queue

    Regards,

  • NoName404 Profile Picture
    on at

    Unfortunately that doesn't work. That doesn't return a record, it says there's only a guid.

     

    The big problem is powerfx is just **bleep**. The docs are **bleep** and doing sometime which should be stupidly obvious is **bleep** near impossible. MS is clueless as always.

  • Verified answer
    NoName404 Profile Picture
    on at

    I got it working. No idea why MS doesn't clearly document this because its not really obvious how to do this. Especially if you are used to CDS API/JS/Powerautomate.

     

    For prosperity's sake this is how you can update a lookup field. The trick is powerfx doesn't accept a GUID (like everything else does...), instead you need to lookup the record first, and then you can patch the record.

     

     

    Set(caseVar, LookUp(Cases As case, case.Case = GUID(Param("recordId")))); //Looks up the case that needs to be patched.
    Set(queueVar, LookUp(Queues As queue, queue.Queue = GUID(ComboBox1.Selected.Queue))); //Looks up the queue record in the queue table that I want to update the case queue field with
    Patch(Cases, caseVar, {Queue: queueVar}); //Patches the case record with the new queue field value.

     

     

     

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

Forum hierarchy changes are complete!

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard