cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
niklasjegg
Helper II
Helper II

Patch and SubmitForm to the same Sharepoint List

Hello.

 

I want to Patch my text Inputs to a Sharepoint List and after that i want to attach a file to the recently created list entry.

 

I have made a custom form with text inputs/dropdown/datepickers/choices for company needs.

I am useing Patch to write all the text inputs. And i have a Single Form for the Attachments that i want to submit too.

 

As far as i can get it to work the formula is creating 2 records 1 with the data and 1 empty with just the attachment.

 

How can i solve this or do i need to use a edit form control? My Formula..

 

Patch(
'Training Request',
{
Title: Title_Input.Text,
Costcenter: Costcenter_input.Text,
Organizer: Organizer_Input.Text,
From_Date: From_Date_Input.SelectedDate,
Till_Date: Till_Date_Input.SelectedDate,
Employee: Employee_Input.Text,
Location: Location_Input.Text,
Costs_Choice: Costs_Choice_Input.Selected,
Costs: Costs_text_Input.Text,
Purpose: Purpose_Input.Text

}

);

SubmitForm(Attachments_Form);

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @niklasjegg 

 

I just noticed something missing with the patch formula. Are you creating a new item or just updating?

If you are creating a new item, then you should add Defaults (ListName) to your patch.

 

 

Patch(
'Training Request', Defaults('Training Request'),
{
Title: Title_Input.Text,
Costcenter: Costcenter_input.Text,
Organizer: Organizer_Input.Text,
From_Date: From_Date_Input.SelectedDate,
Till_Date: Till_Date_Input.SelectedDate,
Employee: Employee_Input.Text,
Location: Location_Input.Text,
Costs_Choice: Costs_Choice_Input.Selected,
Costs: Costs_text_Input.Text,
Purpose: Purpose_Input.Text

}
,Attachments_Form.Updates
);

 

 

View solution in original post

5 REPLIES 5
Adrian_Celis
Solution Supplier
Solution Supplier

Hi @niklasjegg 

 

You can patch a record along with attachment from a separate form by including YourFormName.Updates in your patch function.

 

Try this:

Patch(
'Training Request',
{
Title: Title_Input.Text,
Costcenter: Costcenter_input.Text,
Organizer: Organizer_Input.Text,
From_Date: From_Date_Input.SelectedDate,
Till_Date: Till_Date_Input.SelectedDate,
Employee: Employee_Input.Text,
Location: Location_Input.Text,
Costs_Choice: Costs_Choice_Input.Selected,
Costs: Costs_text_Input.Text,
Purpose: Purpose_Input.Text

}
,Attachments_Form.Updates
);

 

 

niklasjegg
Helper II
Helper II

Hi @Adrian_Celis  i have edited my Formula but now i am only getting a Blank record in my SPList with just the attachment even though i entered every single field.

Hi @niklasjegg 

 

I just noticed something missing with the patch formula. Are you creating a new item or just updating?

If you are creating a new item, then you should add Defaults (ListName) to your patch.

 

 

Patch(
'Training Request', Defaults('Training Request'),
{
Title: Title_Input.Text,
Costcenter: Costcenter_input.Text,
Organizer: Organizer_Input.Text,
From_Date: From_Date_Input.SelectedDate,
Till_Date: Till_Date_Input.SelectedDate,
Employee: Employee_Input.Text,
Location: Location_Input.Text,
Costs_Choice: Costs_Choice_Input.Selected,
Costs: Costs_text_Input.Text,
Purpose: Purpose_Input.Text

}
,Attachments_Form.Updates
);

 

 

View solution in original post

niklasjegg
Helper II
Helper II

Hi @Adrian_Celis  thank you so much. couldnt sleep last night figuring out a solution 🙂

@niklasjegg Glad I could help 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,519)