Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

FormMode property erratic behavior

Posted on by 1,594

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

Categories:
  • Verified answer
    Audrie101 Profile Picture
    Audrie101 on at
    Re: FormMode property erratic behavior

    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

  • Verified answer
    corey_msft Profile Picture
    corey_msft on at
    Re: FormMode property erratic behavior

    @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

  • R3dKap Profile Picture
    R3dKap 1,594 on at
    Re: FormMode property erratic behavior

    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 ?

     

  • corey_msft Profile Picture
    corey_msft on at
    Re: FormMode property erratic behavior

    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.

     

  • CWesener Profile Picture
    CWesener on at
    Re: FormMode property erratic behavior

    Adding @anees and @FilipK to comment.

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard