cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
R3dKap
Super User
Super User

FormMode property erratic behavior

The property FormMode of the SharePointForm object in PowerApps doesn't seem to follow a logical behavior throughout the use of custom SharePoint forms...

 

Note: I'm talking here about one screen and one SharePointForm object for the list (what I mean is: to customize my list's form, I just went to the list in SharePoint and clicked Customize forms in the PowerApps menu -> I did not duplicate the forms/screens to have different behaviors whether I am in Edit mode or View mode or New mode).

 

Here is what I've noticed so far on the SharePointForm object:

  1. FormMode always takes the value of DefaultMode whatever you do (whether you create or edit an item!!!)
  2. FormMode always has the value 0 (Edit mode) in the OnSuccess event of the form (even if you're creating a new item)
  3. Changing the DefaultMode from FormMode.Edit to FormMode.New on the SharePointForm object always sets the FormMode property to 1 (New mode), whether you're creating or editing an item!!!

To recap, it seems that:

  • FormModeDefaultMode
  • and in the OnSuccess event: FormMode = 0 (Edit mode)

 

What we really need in customized SharePoint forms is to have the FormMode property to be set to the action taken by the user: 0 (Edit mode) if the user is editing an existing item, and 1 (New mode) if the user is creating a new item (and eventually 2 if the user is viewing an item).

 

Is this a bug ? Is my logic wrong here ?

 

@CWesener@Audrie-MSFT, I'd really need help on this matter as it is disrupting my work at the moment...

 

Thanks a lot for your help, and feel free to ask me for more details if needed.

 

Emmanuel

2 ACCEPTED SOLUTIONS

Accepted Solutions

@R3dKap Apologies for the tardy reply. 

To answer your question, the Form should not take the DefaultMode if EditForm/NewForm/ViewForm function are called against it.

Are you still experiencing this issue?  If so, can you set a global variable from the OnNew/OnEdit/OnView actions of the SharePointIntegration object and attach it to a Label just so that we can verify that the handlers are being called correctly from SharePoint?

 

ex. 

  OnNew = NewForm(SharePointForm1);Set(varMode, "New")

  OnEdit = EditForm(SharePointForm1);Set(varMode, "Edit")

  OnView = ViewForm(SharePointForm1);Set(varMode, "View")

  ModeLabel.Text = varMode

View solution in original post

Audrie-MSFT
Power Automate
Power Automate

Thank you for clarifying your questions. I have validated that with "Customize Forms" the FormMode persists as Edit and will notify the team of this bug.

Adding @_Corey_ as FYI

 

I will continue the investigations on the other event triggers to validate assumptions. We will continue this conversation offline. Please do log any new feature requests in the ideas forum (link below) so that others can vote on them as well.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas 
quick link: ideas.powerapps.com 

 

Thank you for your patience as we work to enhance the forms experience,

Audrie

View solution in original post

5 REPLIES 5
CWesener
Power Apps
Power Apps

Adding @anees and @FilipK to comment.

Thanks,
Clay.
_Corey_
Power Apps
Power Apps

Hi egallis,

Your first and third points are closely related.  Is the SharePointIntegration control configured correctly?  It is responsible for changing Form modes depending on the action you want to take from SharePoint:

SharePointIntegrationControl.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

To your second point, Form mode always flips to Edit after successfully saving a record.  This is by design.

 

Hi @_Corey_,

 

Here is how my SharePointIntegration control is configured:

 

Image 2.png

 

Just so you know, the OnSave part does a bunch of things but finally does a SubmitForm. It does not influence the FormMode property.

 

Would you mind if we focus first on my first and third points (they are related indeed) first ?

 

Why would the FormMode property always take the value of the DefaultMode even though the user is taking a different action ? I the user creates a new item, FormMode should be New. If he edits an existing item, it should be Edit. If he views an item it should be View.

Am I wrong here ? Or is there a specific reason to the current situation ?

 

@R3dKap Apologies for the tardy reply. 

To answer your question, the Form should not take the DefaultMode if EditForm/NewForm/ViewForm function are called against it.

Are you still experiencing this issue?  If so, can you set a global variable from the OnNew/OnEdit/OnView actions of the SharePointIntegration object and attach it to a Label just so that we can verify that the handlers are being called correctly from SharePoint?

 

ex. 

  OnNew = NewForm(SharePointForm1);Set(varMode, "New")

  OnEdit = EditForm(SharePointForm1);Set(varMode, "Edit")

  OnView = ViewForm(SharePointForm1);Set(varMode, "View")

  ModeLabel.Text = varMode

View solution in original post

Audrie-MSFT
Power Automate
Power Automate

Thank you for clarifying your questions. I have validated that with "Customize Forms" the FormMode persists as Edit and will notify the team of this bug.

Adding @_Corey_ as FYI

 

I will continue the investigations on the other event triggers to validate assumptions. We will continue this conversation offline. Please do log any new feature requests in the ideas forum (link below) so that others can vote on them as well.

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas 
quick link: ideas.powerapps.com 

 

Thank you for your patience as we work to enhance the forms experience,

Audrie

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,374)