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

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 @Eelman 

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 III
Super User III

@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.
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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,653)