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 / Form Default Mode Vs V...
Power Apps
Suggested Answer

Form Default Mode Vs ViewForm,EditForm,NewForm. which will take effect

(1) ShareShare
ReportReport
Posted on by 2,015 Season of Giving Solutions 2025
I have set this inside a form DefaultMode:-
 
FormMode.View
 
and inside the screen On Visible where the form exists, i set this:-
 
If(
    IsBlank(varDTLID),
    If(
        !IsBlank(varNavigationID),
        Set(
            varDTLID,
            varNavigationID
        );ViewForm(DailyIndividualForm),
        NewForm(DailyIndividualForm)
    ),
   EditForm(DailyIndividualForm)
);
 
 
The idea is to set the form as View incase the varDTLID is blank + the varNavigationID is not blank. or to set it as new if the varDTLID is blank and the varnavigation is also blank, other wise to set the form as edit.
 
this is working for deep linking and navigating to the form from the main list to view or edit or create. but now when the user creates a new form , i want to set the form in view mode after the creation is completed, so on the form on success i set this:-
 
Set(varDTLID,DailyIndividualForm.LastSubmit.ID);
ViewForm(DailyIndividualForm);Navigate('CRUD screen');Notify(varConfirmationMessage, NotificationType.Success )
 
 
but currently when the user creates a new form, the user will be redirected to the form in edit mode, instead of view mode. any advice how to fix this?
Thanks
I have the same question (0)
  • Suggested answer
    11manish Profile Picture
    3,038 on at
    The issue is not with ViewForm() itself. After a new record is created, you navigate back to the same screen, which causes the screen's OnVisible property to run
     
    again. Since varDTLID now contains the ID of the newly created record, your OnVisible logic automatically puts the form back into Edit mode, overriding the
     
    ViewForm() call made in OnSuccess.

    To resolve this, use a separate variable (for example, varFormMode) to explicitly control whether the form should open in View, Edit, or New mode. After saving a
     
    new record, set this variable to FormMode.View before navigating back to the screen. Then, in the screen's OnVisible property, use this variable to determine
     
    which form mode should be applied.
  • Suggested answer
    Kalathiya Profile Picture
    2,420 Super User 2026 Season 1 on at

    As per my understanding, the issue is happening because the OnVisible of the screen runs after OnSuccess, and it is overriding the ViewForm() mode.

    So even though the form is set to View mode after submission, the OnVisible logic executes again and switches it back to Edit mode from screen visible property.

    instead of doing and checking the blank value and parameters things you can do like this: Create one variable (e.g. varFormMode) and use it everywhere to decide whether the form is in View, New, or Edit mode.

    Example:

    Form OnSuccess:

    Set(varFormMode, "View"); //Set the form mode
    ResetForm(Self);
    Set(varDTLID, DailyIndividualForm.LastSubmit.ID);
    Navigate('CRUD screen');
    Notify(varConfirmationMessage, NotificationType.Success);

    New button code - OnSelect:

    ResetForm(DailyIndividualForm);
    Set(varFormMode, "New");

    App OnStart - For Query Parameter

    Set(varFormMode, "View");

    Gallery Edit button/icon - OnSelect Property

    Set(varFormMode, "Edit");

    Form Screen On visible code:

    If(varFormMode = "View",
    	ViewForm(DailyIndividualForm),
    		varFormMode = "New",
    			NewForm(DailyIndividualForm),
    			EditForm(DailyIndividualForm)
    );
    ---------------------------------------------------------------------------
    Glad it helped 🙂
    If this fixed your issue,
    please click “Does this answer your question?” to mark it as verified so others can find the solution easily.
    A Like 👍 is always appreciated, and I’m around if you need more help @Kalathiya
  • Suggested answer
    Valantis Profile Picture
    6,526 on at
     
    Navigate back to the same screen reruns OnVisible, and your existing logic there recalculates the mode based on varDTLID, which now points to the new record, so it falls into the Edit branch and overrides the ViewForm() call from OnSuccess.
     
    Fix: separate the mode decision from the OnVisible logic. Add a variable like varFormMode that you set explicitly at every entry point (new, edit, view, post-create), and have OnVisible just read that variable instead of recalculating from varDTLID and varNavigationID.
     
    On the form OnSuccess:
    Set(varDTLID, DailyIndividualForm.LastSubmit.ID);
    Set(varFormMode, "View");
    Navigate('CRUD screen');
    Notify(varConfirmationMessage, NotificationType.Success)
    Screen OnVisible:
    Switch(varFormMode,
        "View", ViewForm(DailyIndividualForm),
        "New", NewForm(DailyIndividualForm),
        "Edit", EditForm(DailyIndividualForm)
    )
     
    Set varFormMode at every place you currently set varDTLID or varNavigationID (deep link entry, edit button, new button), so OnVisible never has to guess the mode again.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 481

#2
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#3
11manish Profile Picture

11manish 291

Last 30 days Overall leaderboard