cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChrisC
Kudo Kingpin
Kudo Kingpin

How to submit multiple forms at once

Hey guys,

 

I have the following code in a button's OnSelect:

 

SubmissionDataCard.DataField = "flows Contact List"; If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); ResetForm(Form1);
SubmissionDataCard.DataField = "flows Test Contact List"; If ('Staff.ParkPlace.Checkbox'.Value, SubmitForm(Form1)); ResetForm(Form1); 
SubmissionDataCard.DataField = "flows Test Contact List 2"; If ('Staff.Plymouth.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1)

 

It changes the data line, and if a matching checkbox is ticked off it will submit the form with the new data. It should do this until the end at 'NewForm', but it stops after 'ResetForm(Form1)' in the first line and I can't figure out why. PowerApps does not give me any errors either.

 

Is there anything I can do to get this to work?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you both SO MUCH for the help! It was a combination of both posts that helped me so I don't know which to accept as a solution. Here is the code that does what I need it to.

 

UpdateContext({DefaultText: MessageBox}); 
UpdateContext({CurrentList: "flows Contact List"}); If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List"}); If ('Staff.ParkPlace.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List 2"}); If ('Staff.Plymouth.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');

I'm beginning to understand this a lot more now. I added in Refresh Data to act as a pause that gives it enough time between data submissions.

 

Thank you both.

View solution in original post

3 REPLIES 3
Meneghino
Community Champion
Community Champion

Hi @ChrisC

 

I am not sure what you mean by "It changes the data line".  Are you referring to this?

SubmissionDataCard.DataField = "flows Contact List

In PowerApps this is just either true or false, it is not a statement by which you assign a value.

 

Since this series of statements is an action (OnSelect) then true or false just do not do anything.

 

I am not a big expert on forms since I avoid them, preferring just to Patch changes to data, so I am not sure how to futher help you.

 

murali
Power Apps
Power Apps

@ChrisC - PowerApps is based on a declarative dataflow language. It's different from imperative languages where you tell objects what to do. In PowerApps, you declare what data flows into control properties and dataflow takes care of the rest for you.

 

With that said, '=' is an equality check operator and not an assignment operator. It's not going to assign "flows Contact List" to SubmissionDataCard.DataField. In order to achieve what you want, you could set the value via a context variable or a collection and have that flow into SubmissionDataCard.DataField

 

e.g. SubmissionDataCard.DataField = CtxtVar1

Button.OnSelect = UpdateContext({CtxtVar1: "flows Contact List"});If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); ResetForm(Form1); and so on

 

Hope that helps.

 

Thanks

Murali

Thank you both SO MUCH for the help! It was a combination of both posts that helped me so I don't know which to accept as a solution. Here is the code that does what I need it to.

 

UpdateContext({DefaultText: MessageBox}); 
UpdateContext({CurrentList: "flows Contact List"}); If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List"}); If ('Staff.ParkPlace.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List 2"}); If ('Staff.Plymouth.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');

I'm beginning to understand this a lot more now. I added in Refresh Data to act as a pause that gives it enough time between data submissions.

 

Thank you both.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,178)