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 / Clear Lookup Column re...
Power Apps
Answered

Clear Lookup Column reference using Power Fx Commands

(0) ShareShare
ReportReport
Posted on by 230

Hi all,

about new Command Apps (Customization Buttons), I need a button able to clear (set null) a lookup field.

https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/commanding-use-powerfx

 

How can I do it using the Power Fx commands? Note: I don't want to use JavaScript. 

 

My first tentative was this expression: 

Patch(Leads,Self.Selected.Item,{'Lookup Column': Blank()});

 

but the Blank() command doesn't work: no reference item clear (it tested it after publishing all customizations).  

 

Unfortunately, there is no Null() function like in Power Automate. 

 

David 

I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @David_Pezzoli :

    The key is that under normal circumstances, such formulas cannot take effect in Canvas (Usually Blank() cannot be used to update a field).

    You could try Unrelate in stead of Patch:

    I assume there are Two Tables Releatedtable and ThisTable,the relationship between this two tables is 1:M.And then you could set the Commands in the "ThisTable":

    For example:

    Unrelate(
     LookUp(ReleatedTable,Name=Self.Selected.Item.ReleatedTable.Name).ThisTable,
     Self.Selected.Item
    )

    I think this link will help you a lot:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-relate-unrelate

    Best Regards,

    Bof

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @David_Pezzoli :

    Power Fx Command is a preview function, so I suggest you use the solution that wants to be more stable JS way:

    vbofengmsft_0-1635759315042.png

    vbofengmsft_2-1635759532926.png

    vbofengmsft_3-1635759542894.png

    JS code:

     

    function test(primaryControl) {
    primaryControl.getAttribute("FieldName").setValue(null)
    }

     

    Add Parmeter

    vbofengmsft_1-1635759493881.png

    Best Regards,

    Bof

     

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard