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 / Disable both buttons f...
Power Apps
Answered

Disable both buttons for the current logged-in user when he submit the form

(0) ShareShare
ReportReport
Posted on by 39

Hi,

 

Seeking your support for my scenario, 

 

I have two buttons in custom Datacard ,both buttons are updating values in another list based on patch function and using           form. updates in its Onselect property, I want when the current logging-in user clicks either of both buttons, the buttons will be disabled for him for the selected record (VarRecord) and of course, the buttons in the other record still on edit unless he clicks on

it.

 

Thanks in advance

Categories:
  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Hi,

    You will have to add a column that will be hidden (you can hide the column from your list view) named “dataSubmitted”

    When patching you will have to set/save this column value dataSubmitted to yes.

    On the edit form you can use below formula to disable the button on DisplayMode property -

    If(ThisItem.dataSubmitted=“yes”, DisplayMode.Disabled, DisplayMode.Edit)

  • Ricardo_Costa Profile Picture
    150 on at

    you must have a column the indicates if the button is enable or disable and another column for the user .

    I just assumed that if the user access the same record again the button must be disabled. Otherwise you can create a local variable the become false on the button click and this variable must be in the Enable property in both buttons

  • haider1 Profile Picture
    39 on at

    Hi,

    Thank you for your response.

    but that will disable the button for all other users, I want to disable it only for the current login user.

  • NandiniBhagya20 Profile Picture
    4,667 Super User 2024 Season 1 on at

    Okay, then instead of saving "yes" value we should save current logged in user's email id

    When patching you will have to set/save this column value dataSubmitted to User().Email.

    On the edit form you can use below formula to disable the button on DisplayMode property -

    If(ThisItem.dataSubmitted=User().Email, DisplayMode.Disabled, DisplayMode.Edit)

  • Ricardo_Costa Profile Picture
    150 on at

    that's why I said you need two columns: one for button status(enable or disable) and other column for the users

  • haider1 Profile Picture
    39 on at

    when i use

    patch(source, thisItem, {dataSubmitted: Use().Email}),

    gives me an error.

  • haider1 Profile Picture
    39 on at

    what do you mean by column for users? and how can patch the current user in the column?

  • Ricardo_Costa Profile Picture
    150 on at

    what error did you get?

  • haider1 Profile Picture
    39 on at

    The patch function has invalid arguments.

  • Ricardo_Costa Profile Picture
    150 on at

    if you are not in a gallery, ThisItem will not work, so you need to you the Lookup function

    patch(source, Lookup(source, source.ID = ID), {dataSubmitted: Use().Email})

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 354 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard