cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
anotherlama
Level: Powered On

Split new item form into 4 forms and submit all at once

Hello! I am having a huge form that is supposed to be filled by the app user. All of the fields will be on one screen. However, I decided to split the form into 4 forms, so I can better place them on the screen and thereby optimize the layout. For the user, the 4 forms should however appear as one. This is why I want to implement a single Submit button for all of the forms. Eventually, the for forms display different fields of the same item, so they should be merged to the same item when submitting them. Any ideas on how to achieve that? Thanks a lot!

2 REPLIES 2
Luke_Timmins
Level 8

Re: Split new item form into 4 forms and submit all at once

I have not tested this but I think you could do something like 

 

- use a button to Submit the first form as a create new record

- save the result of the submitted form to a variable

- use the variable record to populate the other forms item property and have the 3 other forms set to edit mode.

- in the same button you used to submit the initial form submit the other forms. 

 

Something like this 

Button1.OnSelect:

Set(IntitialRecord, SubmitForm(Form1);

SubmitForm(Form2);SubmitForm(Form3);SubmitForm(Form4);

 

Form2/3/4.Item:

InitialRecord

 

In Summary we are creating a record then updating it. 

 

Give it a try let us know how you get on. 

 

Thanks, 

Luke

Community Support Team
Community Support Team

Re: Split new item form into 4 forms and submit all at once

Hi @anotherlama ,

Based on the needs that you mentioned, I think the Patch function in PowerApps could achieve your needs.

 

On your side, you could add 4 Edit forms within your app, then connect these Edit forms to same data source (Set the DataSource property of these 4 Forms to same data source). Within each one of these 4 forms, enable the corresponding fields you want to display.

 

1. When you want to add a new record into your data source:

Set the OnSelect property of the "New" button to following:

NewForm(Form1);
NewForm(Form2);
NewForm(Form3);
NewForm(Form4)

2. When you want to edit an existing record in your data source:

Set the OnSelect property of the "Edit" button to following:

EditForm(Form1);
EditForm(Form2);
EditForm(Form3);
EditForm(Form4)

 

Set the OnSelect property of the "Submit" button to following:

If(
   Form1.Mode = FormMode.New && Form2.Mode = FormMode.New && Form3.Mode = FormMode.New && Form4.Mode = FormMode.New,
   Patch(                     /* <-- Add new record */
'YourDataSource',
Defaults('YourDataSource'),
Form1.Updates,
Form2.Updates,
Form3.Updates,
Form4.Updates
), Patch( /* <-- Edit your existing record */ 'YourDataSource', LookUp('YourDataSource', FilteredColumn = "A specific value"), /* <-- Find the specific existing record you want to update */ Form1.Updates, Form2.Updates, Form3.Updates, Form4.Updates ) )

Please take a try with above solution, check if the issue is solved.

 

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,935)