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 / Model Driven App Comma...
Power Apps
Suggested Answer

Model Driven App Command Button Appearance Depending On Field Values On The Form

(0) ShareShare
ReportReport
Posted on by 10
I’ve created a model driven app that has a solution containing a table named Investment.  On the main form for the Investment table, there is a field named Assigned_Reviewer.  The Assigned_Reviewer is a look up field to the Role table Name (primary) field.
At the top of the Investment Main form is a command button that says Approve.
Here is what I need to know how to do:
When the user viewing a record on the Investment Main form is the same person specified in the Assigned_Reviewer field, I want the Approve command button to be visible and active.  Otherwise, I want the Approve command button to be invisible or inactive.
I need the java script to get current user, which I’m assuming will run for the Investment Main form On Load event, but more importantly, I need the fx code that will compare the current user to the Assigned_Reviewer and then control the appearance of the Approve command button.
Categories:
I have the same question (0)
  • Suggested answer
    narayan225 Profile Picture
    2,547 Moderator on at
    Just change the part where you check for the field in the form.
     
    Instead of checking an option set, check for a lookup field.
    Hope this helps.
  • JS-29072031-0 Profile Picture
    10 on at
    Thank you Narayan for that suggestion, however, I'm looking for help on how to compare the current user of the app to the person listed in the Assigned Reviewer field.  Then, based on whether the current user and the Assigned Reviewer match, make the command button visible or not.  
  • Tony_Suslovich Profile Picture
    4 on at
    Hi @JS-29072031-0, I know it's been almost 2 months since you asked this question, but have you been able to make this work? I'm facing a similar dilemma and tried using User().Email to compare the logged-in user to a value in a lookup field on the form, but I couldn't get User() to work. I have a feeling it just doesn't work for model driven apps, only for canvas apps.
  • JS-29072031-0 Profile Picture
    10 on at
    In the end, I chose not to use a command button in part because I couldn't ascertain the current user via FX code in my model driven app as easily as a canvas app.  So instead, I added an Approved Yes/No field to my Investment table, and used java script, on the form's On Load event, to compare the current user to the assigned user, to determine whether the Approved Yes/No field is locked or unlocked.  If you're not comfortable writing java script: If you clearly describe in detail what you need the script to do, Chat GPT (Openai.com) will do a fairly good job of writing the script for you.  Usually some tweaking is needed, but it can be a huge help.
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard