web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / submit form in a foral...
Power Apps
Unanswered

submit form in a forall loop

(0) ShareShare
ReportReport
Posted on by 120

Hi,

 

I have this requirement to send email to multiple recipients with a Note.

 

And this is a many to many type of relationship, so I need to save the note for all the recipients in my sql server.

 

I am thinking if we can run a loop on the list of recipients and  edit the  recipient field and save multiple forms in the loop. But inside forall i am not able to do it.

 

Formula:

ForAll(Gallery.AllItems.id ,If(true,UpdateContext({SelectedID: id }) , SubmitForm(Form9_3)))

 

I am using "SelectedID" as the default value of "id" field in my form.

 

Please guide me what to do ? If you have any better idea please suggest 🙂

Thanks,

Mohit 

 

Categories:
I have the same question (0)
  • K-A-R-L Profile Picture
    715 on at

    Hi @beniwal ,

    I'm pretty sure you should be able to run a function inside a ForAll() by using the semi-colon character (;) to seperate each function.


    Can you please run this code and check if it works for you.

    ClearCollect(
     NewCollection1,
     {Wheels: 2,Type: "Bicyle"},
     {Wheels: 3,Type: "Tricycle"},
     {Wheels: 4,Type: "Quadricycle"}
    );
    ForAll(
     NewCollection1,
     If(Wheels = 2,Collect(TwoWheelCollection, {Type: Type}));
     If(Wheels = 4,Collect(FourWheelCollection, {Type: Type});SubmitForm(Form1))
    )

    In your case you need to collect the Items on your gallery.

    If(Collection, //Name of Collected Items on Gallery
     !IsBlank(Collection) //Use your formula
     UpdateContext({SelectedID: id }); //Updates the SelectedID Varaible on that Screen
     SubmitForm(Form9_3)) //Submits the Form
    )

    ----------------------------------------------------------------------------
    Thanks,
    K-A-R-L


    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If you thought this post was helpful, please give it a Thumbs Up.

  • Verified answer
    v-xida-msft Profile Picture
    on at

    Could you please share a bit more about your scenario?

    Do you want to submit your form data for each recipient within your Gallery?

    Further, could you please share a screenshot about your app's configuration?

     

    Based on the needs that you mentioned, I think the SubmitForm() function could not achieve your needs. As an alternative solution, I think the combination of ForAll function and Patch function could achieve your needs.

     

    I have made a test on my side, please consider take a try with the following workaround:

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

    ForAll(
     RenameColumns(Gallery.AllItems, "id", "id1"),
     Patch(
     'YourDataSource', /* <-- The 'YourDataSource' represents the data source your Form9_3 connects to */
     Defaults('YourDataSource'),
     {
     id: id1,
     Coumn2: Column2FromYourGallery,
     Column3: Column3FromYourGallery,
     ...
     }
     )
    )

    Note: The Column2FromYourGallery, Column3FromYourGallery, ... represents the column values from your Gallery. Within the '{}' part of the Patch function, you could reference column values from your Gallery. The id, Column2, Column3, ... represents the columns in your data source (your Form9_3 connects to).

     

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

    ForAll function

    Patch function

    RenameColumns function

     

    Best regards,

    Hi @beniwal ,

  • beniwal Profile Picture
    120 on at

    hi @v-xida-msft 

     

    Thanks it worked 🙂

  • Sage22 Profile Picture
    40 on at

    I have a new form that I would like to submit 1 or more times based on what number the user selects in a set of radio buttons. How can the Forall function work with the Submitform function?

    @v-xida-msft 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard