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