Hello everyone,
I am developing an app similar to a shopping cart, the user can add multiple orders and send them, but an attachment is required for each order.
I am using a collection and the function for All and patch to send to the SharePoint list, after some research, I was informed that there is no possibility to send attachment with the patch function, only with Submit and then perform the edition of the SharePoint list with my other values using the Last Submit, so it was done, I created a form only with the attachment and another with the other fields, however, without success, there is some error in my code? is there another possibility to do this in power apps or even with power automate?
Translated with www.DeepL.com/Translator (free version)
Solved! Go to Solution.
Hello, thanks for the help, I believe that this solution would only serve for a specific line, in my case I have a collection with several lines, but I managed to solve my problem!
I created two forms, one for the attachment and another for the other fields, in the attachment form I added another generic field as a key and left it invisible with a default value of two other columns together ( you can decide any value ), and sent this key field also to the gallery, when filling the fields and inserting it in the shopping cart is like this :
SubmitForm(FormAttachment); <---- send the attachment to the SP list in the attachment form ( will be sent the attachment and the key created)
Collect( <-----Sending the form values ( with the other values ) to the collection
colpessoa,
{
ChaveCol: DataCardValue6.Text & DataCardValue9.Text, <--- Column key
NomeCol: DataCardValue6.Text,
SobrenomeCol: DataCardValue7.Text,
IdadeCol: DataCardValue8.Text,
CidadeCol: DataCardValue9.Text
}
);
this way the attachment is sent to the SP list and the other fields are blank.
Then I used For All with Patch comparing the key column of the collection with the key column of the SP list , it looks like this :
ForAll(
colpessoa,
Patch( AuxiliarTesteMulti, LookUp( AuxiliarTesteMulti, Collumn key SP List = Collumn key collection ) ,
{
Nome: NomeCol,
Sobrenome: SobrenomeCol,
Idade: IdadeCol,
Cidade: CidadeCol
}
)
);
this way I solved my problem, any questions I am at your disposal! Thank you all.
Hi @GabrielGondin ,
Do you want to add a attachment to a SP list item using Patch function directly?
If so, there is a an alternative solution, you could consider take a try to only add the Attachments field within the Edit form. I have made a test on my side, please take a try with the following workaround:
1\Add an edit form(Form3)
2\Add a button
OnSelect:
Patch(
'List A',/*'List A' is my data source*/
First('List A'),/*Modify the first record in the data source*/
{Title: "1"},
Form3.Updates
)
On your side, you should type following formula:
Patch(
'YourSPList',
'Your specified record',
{
Column1:TextInput1.Text,
Column2:TextInput2.Text,
Column3:TextInput3.Text,
...,
ColumnN:TextInputN.Text
},
EditForm1.Updates
)
Note: The Editform1 represents the Edit form control within your app, which only display the Attachments field.
I think these links will help you a lot:
https://powerusers.microsoft.com/t5/Building-Power-Apps/Saving-attachments-using-Patch/td-p/277984
Best Rergards,
Bof
Hello, thanks for the help, I believe that this solution would only serve for a specific line, in my case I have a collection with several lines, but I managed to solve my problem!
I created two forms, one for the attachment and another for the other fields, in the attachment form I added another generic field as a key and left it invisible with a default value of two other columns together ( you can decide any value ), and sent this key field also to the gallery, when filling the fields and inserting it in the shopping cart is like this :
SubmitForm(FormAttachment); <---- send the attachment to the SP list in the attachment form ( will be sent the attachment and the key created)
Collect( <-----Sending the form values ( with the other values ) to the collection
colpessoa,
{
ChaveCol: DataCardValue6.Text & DataCardValue9.Text, <--- Column key
NomeCol: DataCardValue6.Text,
SobrenomeCol: DataCardValue7.Text,
IdadeCol: DataCardValue8.Text,
CidadeCol: DataCardValue9.Text
}
);
this way the attachment is sent to the SP list and the other fields are blank.
Then I used For All with Patch comparing the key column of the collection with the key column of the SP list , it looks like this :
ForAll(
colpessoa,
Patch( AuxiliarTesteMulti, LookUp( AuxiliarTesteMulti, Collumn key SP List = Collumn key collection ) ,
{
Nome: NomeCol,
Sobrenome: SobrenomeCol,
Idade: IdadeCol,
Cidade: CidadeCol
}
)
);
this way I solved my problem, any questions I am at your disposal! Thank you all.