Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
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 

  • Verified answer
    v-bofeng-msft Profile Picture
    on at
    Re: Clear Lookup Column reference using Power Fx Commands

    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

     

  • v-bofeng-msft Profile Picture
    on at
    Re: Clear Lookup Column reference using Power Fx Commands

    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

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Microsoft Dataverse

#1
mmbr1606 Profile Picture

mmbr1606 22 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 17

#3
Michael E. Gernaey Profile Picture

Michael E. Gernaey 15 Super User 2025 Season 1

Overall leaderboard

Featured topics