cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Kudo Kingpin
Kudo Kingpin

Re: How to submit multiple forms at once

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
Highlighted
Community Champion
Community Champion

Re: How to submit multiple forms at once

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.

 

Highlighted
Power Apps
Power Apps

Re: How to submit multiple forms at once

@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

Kudo Kingpin
Kudo Kingpin

Re: How to submit multiple forms at once

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,118)