cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
powerapps890
Post Prodigy
Post Prodigy

Patch attachment to sharepoint

How can I allow the user to add attachments and submit it to a sharepoint list. This is my current patch statement for the data cards. SubmitForm(Form1);NewForm(Form1);Patch('CPQ Comment', Defaults('CPQ Comment'), {Title: DataCardValue3.Text, Comment: TextInput2.Text, Name_:Label6.Text, Date:Label7.Text}); Navigate(BrowseScreen1,Fade); Reset(TextInput2) 

powerapps890_0-1596648129940.png

I copied and pasted the attachment card from the edit form.

22 REPLIES 22

I have a detail screen this is on the submission button SubmitForm(Form1);NewForm(Form1);Patch('CPQ Comment', Defaults('CPQ Comment'), {Title: DataCardValue3.Text, Comment: TextInput2.Text, Name_:Label6.Text, Date:Label7.Text}); Navigate(BrowseScreen1,Fade); Reset(TextInput2) . In this detail form there an attachment card, but I also have an attachment card in the edit form I have. I just don't understand how to get an attachment into my sharepoint list. @v-bofeng-msft 

Hi @powerapps890 :

SubmitForm(Form1) can upload the attachments added in the form to the SP list, you can check it in your SP list.

I've made a test for your reference:

40.gif

Best Regards,

Bof

So, I have BrowseGallery1.Selected in my items for the form because it needs to pull that information and send the attachment, but when i try to do it at the same time with a ; it does not work can I not use both BrowseGallery1.Selected and what you said needs to go in items? The only thing the user should be changing is the attachments @v-bofeng-msft 

Hi @powerapps890 :

Sorry I still don't understand what you mean, can you provide the complete settings of your app?

How many data sources do you have now? What is the data source of the gallery? What is the data source of the form? What data source do you wish to update?

Best regards,

Bof

There are two data sources one patches the radio button answers. The second patches this SubmitForm(Form1);NewForm(Form1);Patch('CPQ Comment', Defaults('CPQ Comment'), {Title: DataCardValue3.Text, Comment: TextInput2.Text, Name_:Label6.Text, Date:Label7.Text}); Navigate(BrowseScreen1,Fade); Reset(TextInput2), I just want to include an attachment in this, Annotation 2020-08-09 224633.jpg. It is called detailscreen1 @v-bofeng-msft 

Hi @powerapps890 :

Maybe my question is not clear enough, let me ask it again.
About BrowseGallery1:
What is it's items proeprty?
About Form1:
What is it's DataSource preprty?
What is it's Items proeprty?
What is it's DefaultMode property?
About your formula.
Why do you need to use Patch() to add a new record after you have submitted the form using SubmitForm(Form1)?
If you need to add attachments in Patch(), the solution I provided before is the only way.

Best Regards,

Bof

Filter(
Regression,
If(
IsBlank(ComboBox1.Selected.Result) || ComboBox1.Selected.Result = "All",
true,
Function in ComboBox1.SelectedItems
) && If(
IsBlank(Filter.Text),
true,
Filter.Text in Country
) && If(
IsBlank(Search_.Text),
true,
Search_.Text in 'Focus Topic'
)
) - items for browse

 

Regression - Datasource for detailform1

BrowseGallery1.Selected - detailForm1 item

There is no default mode for detailform1

I tried the solution you provided and it would not patch? So I have the datasource regression for this and its patching to cpq , how does an attachment appear without an attachment column? @v-bofeng-msft 

Hi @powerapps890 :

The data source of your form is Regression, but the data source you want to patch() is'CPQ Comment', so it cannot be updated.
So you need to create another NewForm.
1. Set the defalult attribute of each data card of this form to the value you want. (Reference the value of the control in Form1)
2. Set the defalut attribute of this form to false (hide it)
3. Use this code:

 

SubmitForm(NewForm); NewForm(NewForm); SubmitForm(Form1); NewForm(Form1);

 

Best Regards,

Bof

I am not sure I understand. You want me to put another form within my form. Where does this go 

SubmitForm(NewForm); NewForm(NewForm); SubmitForm(Form1); NewForm(Form1);

Which form does attachments go in. @v-bofeng-msft  

Annotation 2020-08-16 174024.jpg - This is called DetailForm1 and attachments is a separate form called EditForm1_1. @v-bofeng-msft 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,135)