cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
akg1421
Helper III
Helper III

Form action OnSave missing when customizing SP List form in PowerApps

OnSave action of my list form SharePointForm1 is not present when customizing list form in Powerapps.

*Requirement is to Patch a collection with SP List with the Form's  OnSave functionality (separate save button is not required)

 

Snap 2021-07-29 at 00.08.38.png

 

Snap 2021-07-29 at 00.08.53.png

 

Guidance will be much appreciated?! @WarrenBelz @BCLS776 @CNT @RandyHayes @Drrickryp @timl @Pstork1 @Anonymous 

4 REPLIES 4
GarethPrisk
Resident Rockstar
Resident Rockstar

There is no OnSave property on a Form.

You might mean OnSuccess which is the hook you can use for when the Form is submitted successfully.

The others may be helpful too:

  • OnFailure - to do something if it fails to save
  • OnReset - to do something if/when you need to reset the Form

 

To initiate the Form to "Save", you would use SubmitForm(FormName)

@GarethPrisk How do we trigger SubmitForm(FormName) via the default Save button of List form? 

In my case OnSuccess of the form "SharePointForm1" may create an empty item row apart from the required operation. A list item ID will be generated unnecessarily. Also form validations may fail and OnSuccess may never be called... Is there any workaround to meet the requirement?

GarethPrisk
Resident Rockstar
Resident Rockstar

Clicking the Save button on a SharePoint-based Power App, will cause the app to SubmitForm() for the given form.

There are several assumptions

  • You have extended the List, using Power Apps, to customize a "Form" for it
    • This is then generated automatically
    • This includes the SharePointForm integration object
  • This is the built-in App/Form for the List, and is shown when you click 'Open' for a record, or New
  • The Form automatically has its properties set
    • It knows the List you're on is the DataSource
    • It knows the Item you've "opened" is the Item
      • If it's blank, then it tries to use the first record in the list (i.e. Studio editing)
    • Somehow, it knows to switch the EditMode - not sure
  • When you click Save on the button outside the form/app
    • It appears to SubmitForm for the Form
    • It also runs that code, which is special to the SharePoint form to try to hide it
      • ResetForm(Self); RequestHide()

 

You can confirm this by replacing the OnSuccess for the Form, with something like Notify("Save Was Clicked"); to confirm it is invoked.
Any required fields/validation is still checked, when clicking Save. It assumes you have required columns, or have added custom validation logic.

GarethPrisk_0-1627505463204.png

 

RandyHayes
Super User
Super User

@akg1421 

OnSave is not on the form.  It is on the integration.  Click on the SharePointIntegration object in your control tree and you will find OnSave there.

RandyHayes_0-1627506050133.png

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,764)