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 / Enable Edit form only ...
Power Apps
Answered

Enable Edit form only if status value is not approved

(1) ShareShare
ReportReport
Posted on by 15

Greetings, community! I'm facing some challenges with Power Apps. My application enables users to complete a form (stored in a SharePoint database) for a specific service. There's a screen that allows them to search for and view previously created items using the same form (I've set a variable "varFormMode" to toggle the form between new, view, and edit modes as needed). The "Status" column, which is hidden from users, defaults to "Open". This column's value is automatically updated to "Approved" or "Repproved" by a Power Automate flow based on the user manager's criteria and an approval trigger in Teams. I'm attempting to implement an "Edit Form" on the "Consult Screen" where users can make edits only if their form hasn't been approved by their manager, or if the status is still "Open". If the status doesn't meet these conditions, a message should appear on the screen, and the form should be viewable in View mode only. I've tried the following code without any errors from PowerApps, but it's not functioning as expected. Could anyone assist me with this? Below is the code:

 

 

 

If(
 DataCardValue15.Selected.Value = "Approved by Manager";
 Set(
 varFormMode;
 FormMode.View
 );
 "Aproved";
 Set(
 varFormMode;
 FormMode.View
 );
 FormMode.Edit
);;
Set(
 varItem;
 ThisItem
);;
Navigate(
 scrnRequest;
 ScreenTransition.Fade

 

 

 

Categories:
  • Verified answer
    Michael E. Gernaey Profile Picture
    53,975 Super User 2026 Season 2 on at

    HI @CampoGu 

     

    When you  say it doesn't  work, I am assuming you mean its  staying in edit mode?

     

    Firstly you should use a Switch, not an if.

     

    Secondly you are using a  variable to try to set the mode and don't not that way.

    Set(viewMode, "Edit");

    or

    Set(viewMode, "View")

     

    In your forms DefaultMode property

    Switch(viewMode

        "Edit",

          FormMode.Edit,

     "View"

     FormMode.View

    );

     

    Also it looks like you are trying to use the If as a switch, which I get but switch is cleaner to look at than hierarchical Ifs

     

    Anyway try it like that and let me know.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

     

  • CampoGu Profile Picture
    15 on at

    Well,  its  staying on View Mode. 

     

    So, the DefaultMode of my form is the varFormMode that is used to change the FormMode, but using the same screen instead of multiple types of forms. So, when the user creates a new request, the FormMode is set to New in the variable. When he search for an created item on the "Consult Screen" (Is Basically a gallery with the created items filtered by their ID Column), and click on a display request button, that same screen shows the selected Item, but only on View Mode. Can I do this process without the use of variables to use the code you pointed on DefaultMode property?

  • Michael E. Gernaey Profile Picture
    53,975 Super User 2026 Season 2 on at

    @CampoGu 

     

    As long as you have something to compare sure. Meaning, you can just do the switch with the Value, but quadrupple check that your spelling (no spaces, caps etc) is correct, but sure you can do it without the variable.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • Michael E. Gernaey Profile Picture
    53,975 Super User 2026 Season 2 on at

    If its works out please mark my post as the solution.

     

    Thanks,

    -michael

  • CampoGu Profile Picture
    15 on at

    It worked with the Switch function, thank you @FLMike !

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

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard