PowerApp and SharePoint

Options

Hi,

Does anyone know if there is issue with using both SubmitForm and Patch?

We have a PowerApp that has 1 data source, sharepoint list, and in the app, we have an editform that allow editing of some properties of one record and when submitted, the OnSelect handler will issue SubmitForm and then also do a PATCH to patch a few addiitonal fields. We are finding this process to be erroranous at times and for now have found out that SubmitForm is async, meaning by the time the next function is executed, we do not know if SubmitForm actually finished yet or not.

Looking deeper, we found that we should be using the OnSuccess and OnFailure handler on the Edit Form to ensure the SubmitForm is completed (successfully or not) before the next function of PATCH is called.

My question is, is PATCH also async or sychronous?

Comments

  • Hi @Alex Wong, on paper it's synchronous. But because Patch in PowerApps has so many modifiers and also because buttons/data fields have a bunch of checks they do per interaction with the app it sometimes registers to dev/user as fields displaying poorly, or worse data destination showing bad result.

    Luckily lots and lots of ways to combat this. The easiest is probably to create and work with a temp/virtual collection for all data handling inside the app.

    Then, when you do patch/submit, or anything really make references to the collection instead of the fields.

    From there, you can UpdateContext of various variables, or have fields grab/combine/display correct data.

    You can definitely use both together. In my experience I like putting a bunch of controls and fail-safes or verification on my submit. (Good practice as is)

    The main trick for when you patch is learning the I believe 2 or 3 ways it can assess which record it is updating, also consider how many data rows your patch is searching if it's a high number the data table/collection needs to be sorted/filtered.

    Feel free to message for any clarification(s..)!

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Lucien Piekut
    Thanks,

    I'm going to opt for not using SubmitForm and PATCH together, instead, will use SubmitForm and OnSuccess handling to ensure the data update is completed. When needed, will use a global variable for the “current selected item" to avoid issue.

Categories