cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dan_harner
Frequent Visitor

Patching custom fields, Attachments form

I am fairly new to powerapps, as of this week. I have 3 screens, of which 2 are to be filled out by the user and then they go back to the SP list. I used all custom inserts for these except for a form that solely has Attachments.

I can get everything submitted back to SP but when I do successfully get Attachments sent back, they are either above or below the patched data. (Depending on if i put the submitform before the patch or after the patch.)

 

How can I get all of this to be in the same row? I've exhausted my search efforts to no avail. 

 

Patch(TaskDOW, Defaults(TaskDOW),{Description: descriptionBox.Text, TargetDate: targetDate.SelectedDate, DateCreated: dateCreated.SelectedDate, TaskGroup: taskGroupDrop.Selected.Value, Source: sourceDrop.Selected.Value, Department: departmentDrop.Selected.Value, TaskType: taskTypeDrop.Selected.Value, Location: locationDrop.Selected.Value, DateLastUpdated: dateLastUpdated.SelectedDate, DateCompleted: dateCompleted.SelectedDate, WorkOrder: workOrderBox.Text, SupportingDocument: supportDocBox.Text,Comments: commentsBox.Text, AssignedTo: assignedToDrop.SelectedItems});Navigate(Home,ScreenTransition.Fade);Set(varPopup,false)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-monli-msft
Community Support
Community Support

Hi @dan_harner ,

 

To patch the attachments to SharePoint as one item with the before controls in your formula, the formula should be:

 

Patch(TaskDOW, Defaults(TaskDOW),
{Description: descriptionBox.Text, TargetDate: targetDate.SelectedDate, DateCreated: dateCreated.SelectedDate, TaskGroup: taskGroupDrop.Selected.Value, Source: sourceDrop.Selected.Value, Department: departmentDrop.Selected.Value, TaskType: taskTypeDrop.Selected.Value, Location: locationDrop.Selected.Value, DateLastUpdated: dateLastUpdated.SelectedDate, DateCompleted: dateCompleted.SelectedDate, WorkOrder: workOrderBox.Text, SupportingDocument: supportDocBox.Text,Comments: commentsBox.Text, AssignedTo: assignedToDrop.SelectedItems,
Attachments1.Attachments}
);
Navigate(Home,ScreenTransition.Fade);
Set(varPopup,false)

Attachments1 is the attachment control's name.

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@dan_harner 

 

I'm not fully understanding the issue (mostly because I was looking at your formula).

Are you stating that you have 2 screens with just controls on them and then 1 screen that has a Form on it for just Attachements?

My confusion is that I do not see anything in your formula for the attachments.

Also, it appears that this formula you provided is on some sort of "final" submit button as you then navigate to the Home screen.

 

If you have a Form, then you will want to use SubmitForm to submit what is in that form to the datasource. 

However, if you do this all in the final step, then you will get two rows in your datasource, one with the Patch data and one with the Attachments. Perhaps this is what you mean by "above or below the patched data"??

 

So, what I would attempt is to put your Patch formula before the screen with the Attachments and make this change:

Set(currentRecord,
Patch(TaskDOW, Defaults(TaskDOW), {Description: descriptionBox.Text, TargetDate: targetDate.SelectedDate, DateCreated: dateCreated.SelectedDate, TaskGroup: taskGroupDrop.Selected.Value, Source: sourceDrop.Selected.Value, Department: departmentDrop.Selected.Value, TaskType: taskTypeDrop.Selected.Value, Location: locationDrop.Selected.Value, DateLastUpdated: dateLastUpdated.SelectedDate, DateCompleted: dateCompleted.SelectedDate, WorkOrder: workOrderBox.Text, SupportingDocument: supportDocBox.Text, Comments: commentsBox.Text, AssignedTo: assignedToDrop.SelectedItems}
)); //Notice we are assigning the returned Patched record to our variable currentRecord.
Navigate(attachmentScreenName, Fade)

Then, on your EditForm with the attachment datacard, set the Item property to:

   currentRecord

 

Then finally on that screen, have your Submit button with the following formula:

SubmitForm(yourEditFormName); Set(varPopup,false); Navigate(Home,ScreenTransition.Fade)

 

Please fill in the above orange items with the proper names in your app.

 

I hope this helps you some.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
v-monli-msft
Community Support
Community Support

Hi @dan_harner ,

 

To patch the attachments to SharePoint as one item with the before controls in your formula, the formula should be:

 

Patch(TaskDOW, Defaults(TaskDOW),
{Description: descriptionBox.Text, TargetDate: targetDate.SelectedDate, DateCreated: dateCreated.SelectedDate, TaskGroup: taskGroupDrop.Selected.Value, Source: sourceDrop.Selected.Value, Department: departmentDrop.Selected.Value, TaskType: taskTypeDrop.Selected.Value, Location: locationDrop.Selected.Value, DateLastUpdated: dateLastUpdated.SelectedDate, DateCompleted: dateCompleted.SelectedDate, WorkOrder: workOrderBox.Text, SupportingDocument: supportDocBox.Text,Comments: commentsBox.Text, AssignedTo: assignedToDrop.SelectedItems,
Attachments1.Attachments}
);
Navigate(Home,ScreenTransition.Fade);
Set(varPopup,false)

Attachments1 is the attachment control's name.

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

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 (1,850)