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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Submit and patch at th...
Power Apps
Answered

Submit and patch at the same button

(0) ShareShare
ReportReport
Posted on by 22

Hi all, 

 

I'm hopiong you can help me out. 

 

I have created an app with some fileds which take their data from SQL and one form in order to attache a file. I have created a button to save all these to SharePoint with patch and submit form, but my problem is that the submitForm doesn't work. 

 

I've used this as the onselect:

 

Patch(
'AVG PowerApp';
Defaults('AVG PowerApp');
{
ID0: StudentIdLbl.Text;
Comments: CommentsTextInput.Text;
Course: CourseDropdown.Selected.Value;
Student: StudentDropdown.Selected.Value;
Teacher: TeacherLbl2.Text
}
);;
SubmitForm(AttachementForm);;
Reset(CommentsTextInput)

 

At the attached file you can see the picture from my app for better understanding.

 

How i can combine at the same button the submitform for attachement and the patch for the other data ?

 

Thank you in advance.

2018-12-14_9-58-10.png
Categories:
  • Mr-Dang-MSFT Profile Picture
    Microsoft Employee on at

    Hi @Ntinos,

    It sounds like you want both SubmitForm and Patch to run at the same time. You can use Concurrent() to make them simultaneous:

     

    Concurrent(
     Patch(
     'AVG PowerApp';
     Defaults('AVG PowerApp');
     {
     ID0: StudentIdLbl.Text;
     Comments: CommentsTextInput.Text;
     Course: CourseDropdown.Selected.Value;
     Student: StudentDropdown.Selected.Value;
     Teacher: TeacherLbl2.Text
     }
     );
    
     SubmitForm(AttachementForm)
    );;
    
    Reset(CommentsTextInput)

     

    But I am wondering--is the Form in new mode or edit mode? Can you share more about that setup?

  • Ntinos Profile Picture
    22 on at

    @Mr-Dang-MSFT

     

    You have understood right!

     

    I will try your code and i will inform you.

     

    Also the powerapp that i have created is custom. Meaning that as you can see from the picture i have the "AttachementForm" which is connected to SP and i have separated some dropdowns,labels and one textbox which take their data from SQL. All these data i tried to save them every time at SP with one button.

     

    If you need to send you any other information please tell me.

     

    2018-12-14_11-32-21.png
  • Ntinos Profile Picture
    22 on at

    @Mr-Dang-MSFT

     

    Hello,

     

    I tried it and the code create two separate raws at SP. The first raw contains only the attache file and the second raw contains only the data from other fields(labels,drobdowns etc) without the attache file.

  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Ntinos,

    Do you add two separated forms within the screen of your app? One form for data from SQL and another form for uploading Attachments?

    Do you want to patch the other data along with the attachment files into your SP list data source (insert into same one record)?

    Based on the formula that you provided, I think there is something wrong with it. The Patch formula you provided would insert a new record into your SP list, the SubmitForm formula you provided would also insert a new record into your SP list. They are in separated records rather than same record.

    I assume that you only enable the Attachments field (Data card) within your AttachmentsForm, I have made a test on my side, please take a try with the following workaround:

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

    SubmitForm(AttachementForm)

    Set the OnSuccess property of the AttachmentForm to following:

    Patch(
     'AVG PowerApp';
     LookUp('AVG PowerApp', ID = AttachmentForm.LastSubmit.ID); /* <-- Modify here */
     {
     ID0: StudentIdLbl.Text;
     Comments: CommentsTextInput.Text;
     Course: CourseDropdown.Selected.Value;
     Student: StudentDropdown.Selected.Value;
     Teacher: TeacherLbl2.Text
     }
     );;
    Reset(CommentsTextInput)

    Note: I assume that the StudentIdLb1, CommentsTextInput, CourseDropdown, ... etc are all in another form (not the AttachmentForm) which retrieves data from SQL. If the StudentIdLb1, CommentsTextInput, CourseDropdown, ... etc also in the AttachmentForm, please use SubmitForm function to submit your data instead of Patch function.

     

    Best regards,

    Kris

  • Verified answer
    Ntinos Profile Picture
    22 on at

    Hi @v-xida-msft,

     

    Finally, i choose to insert all the data to one Form and use at the submit button at OnSelect the SubmitForm in order to send them all at SP with one record.

     

    I was looking for another solution that would send the data more quickly, but now i am ok.

     

    Thank you very much.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard