PowerApps Form – submit multiple forms at once without Patch and extra buttons

1+

Everyone knows that PowerApps Forms are much trickier than their siblings – PowerApps Apps. So when it comes to creating a multi form experience it’s not the same for PowerApps Forms. In fact Microsoft PowerApps Team recommends using a Patch function or other workarounds. So officially multi forms for PowerApps Forms are not supported.

It’s obvious why one would like to use multiple forms over a huge single form – a better user experience and a natural feel.

So it is doable and the benefits of using it the way I described below are:

  • No extra buttons. While a custom button can compliment your form and expand its functionality, you still have standard buttons you cannot hide.
  • All columns can stay required on a SharePoint level. The forms will react to those required fields as needed.
  • No Patch function. Don’t get me wrong, the Patch function is very useful but it modifies an item the 2nd time. This might interfere and trigger a Flow you have.
  • Multiple forms and multiple screens with their own code.
  • No variables (except for the one that determines a form DefaultMode).

Now before we get to the code I wanted to link a YouTube video where DeShon Clark explains a similar concept – MPP: 3 of 7 | PowerApps Multiple Form Trick for Custom Forms (Aug 2019 Update)

The slight difference is I use both multiple forms and screens at once which might give you some flexibility as you can have different onVisible code if needed. Also my example doesn’t involve any hidden fields or other controls.


EXAMPLE

Let’s create a SharePoint List, for the purpose of the example it will have 2 required text columns in it:

Then we create a PowerApps Form using a Customize Forms feature.

The concept of this solution is very simple:

  • There will be a screen and a form a user will never use and navigate to. However, that very form is the one a user will submit. It will have every field on it.
  • The other 2 forms and screens (or as many as you would like to have) is what a user will interact with. The latter are the multi forms we would like to have. So let’s make copy of our screen and form and split the info accordingly.

In other words:

  • Form1 and Screen1 – Field A
  • Form2 and Screen2 – Field B
  • AuxForm and AuxScreen – Field A and Field B

To make it a bit simpler to understand we will rename them.

Several changes to SharePointIntergrationOnNew property:

NewForm(SharePointForm1);
Navigate(
    FormScreen1,
    ScreenTransition.Fade
);
Set(
    SPFormMode,
    "New"
)

OnEdit property:

EditForm(SharePointFormAux);
Navigate(
    FormScreen1,
    ScreenTransition.Fade
);
Set(
    SPFormMode,
    "Edit"
)

OnView property:

ViewForm(SharePointFormAux);
Navigate(
    FormScreen1,
    ScreenTransition.Fade
);
Set(
    SPFormMode,
    "View"
)

OnSave property:

SubmitForm(SharePointFormAux)

OnCancel property:

ResetForm(SharePointFormAux)

FormScreen1 will have a Next button, OnSelect property:

Navigate(
    FormScreen2,
    ScreenTransition.Fade
)

FormScreen2 will have a Back button, OnSelect property:

Navigate(
    FormScreen1,
    ScreenTransition.Fade
)

The same adjustments for all 3 forms (SharePointForm1, SharePointForm2, and FormScreenAux).

OnSuccess property:

ResetForm(SharePointFormAux);
ResetForm(SharePointForm1);
ResetForm(SharePointForm2);
RequestHide()

DefaultMode property:

If(
    SPFormMode = "New",
    FormMode.New,
    If(
        SPFormMode = "Edit",
        FormMode.Edit,
        FormMode.View
    )
)

Now we need to connect the fields on the auxiliary form with the fields on the main two forms. The image below will help visually:

DataCardValue1 Text Input, Default property:

DataCardValue1_1.Text

DataCardValue2 Text Input, Default property:

DataCardValue2_2.Text

RESULT

1+

This Post Has 6 Comments

  1. Jimmie

    How can you make this work when using the other controls (Choice, People, Date, Multi Line)? The only one I can seem to get to work with this is a Single Line of Text field.

    0
    1. Jimmie

      I also need an attachment field to work.

      0
      1. Pavel Bludov

        Hi Jimmie,
        I just have tested it with Date, Choice, and Attachments fields and had 0 issues whatsoever. It worked perfectly.
        Keep in mind that it’s not going to be DataCardValue1_1.Text every single time. A part following the dot will be different depending on a type of your field.

        0
        1. Jimmie

          Ok so for the Choice field, I have Department_DataCard1 with DataCardValue3, I went to my hidden screen and tried to set the Default Value on DataCardValue3_1 to DataCardValue3.Selected. When i run a test, I pick a choice in the Department_DataCard1 and the hidden field remains blank. I got the multi line text fields to work by using a variable in the OnChange property and then setting the default value of the hidden multi line text field to the variable name. Not sure why it wont work the other way though. I tried using .DisplayName for the people field and .Attachments for the Attachment field but those were not working either. Thanks for the help

          0
          1. Jimmie

            Ok, I think I figured it out. If I Change the Default value for the DataCard and not the actual Drop Down Box for the Choice and People fields they update correctly. So for the Department, I set Department_DataCard_1 Default to DataCardValue3.Selected and it works. Curious as to why on the Single line of text fields we entered the value on the DataCardValue Default field.

            0
          2. Pavel Bludov

            For choice fields, it should be DefaultSelectedItems where you set a default value.
            For attachment fields, it should be Items where you set a default value.
            I’m sure it will work with other fields if carefully working with the right default values.

            0

Leave a Reply