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 / show or hide a custom ...
Power Apps
Answered

show or hide a custom command button using PowerFx when a form is "New"

(0) ShareShare
ReportReport
Posted on by 109

Hi,

@ScottDurow 

I am trying the new custom command designer with Power Fx in a Model-driven app, and I want to hide the button if the form is in "new" state, so I am trying to use IsBlank(Self.Selected.item) but but it appears that the self property returns an error on a new form then the whole result comes as true, here is a command checker screenshot

 

malkhawaja_0-1631825229771.png

 

so what should I use as a formula to check for the "New form", so I can be able to hide the button?

 

regards,

Mohammad

 

Categories:
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @malkhawaja ,

     

    This function may not meet your needs at present because it is in the preview stage.

    I suggest you use ribbon workbench.

    vxiaochenmsft_0-1632194165608.png

    vxiaochenmsft_1-1632194176816.png

    vxiaochenmsft_2-1632194214085.png

    vxiaochenmsft_3-1632194229576.png

    vxiaochenmsft_4-1632194238413.png

     

     

    Best Regards,

    Wearsky

     

     

  • Verified answer
    Sachin-Gupta Profile Picture
    Microsoft Employee on at

    It works for me if I use following Power FX code. It may be possible that the product issue has been resolved.

    -> If(!IsBlank(Self.Selected.Item.'Created By'), true, false)
  • mokhawaja Profile Picture
    109 on at

    Hi  ,yes eventually I got it to work on a similar function, but I have another one with a different condition... I have a custom button on the main grid of accounts table, and I want it to show or hide based on the permissions the user has on another table (not accounts table), so I tried this:

    ---DataSourceInfo('Coaching Reports',DataSourceInfo.CreatePermission

    ---If(DataSourceInfo('Coaching Reports',DataSourceInfo.CreatePermission),true,false)

     

    But no success!

    any suggestions?

     

    Thanks,

    Mohammad

    @Sachin-Gupta

  • Emejcz Profile Picture
    49 on at

    Hey guys.

    I have similar need there.

     

    Lets's say I have a form Invoices with field InvoiceType filled with some values.

     

    I would like to use PowerFX formula to hide Main Form button if InvoiceType is Corrections.

    Is it possible somehow to get that InvoiceType value from form Invoices to use witg PowerFX? I don't see that field easly available...

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard