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:
- FormMode always takes the value of DefaultMode whatever you do (whether you create or edit an item!!!)
- FormMode always has the value 0 (Edit mode) in the OnSuccess event of the form (even if you're creating a new item)
- 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:
- FormMode = DefaultMode
- 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