I have an occasion to use Patch() to update an existing record outside of the context of a form or a gallery. I have a file uploader using an attachment control and when upload is successful (i.e., OnAddFile), I need to execute a Patch() to update a choice field, 'Status' in SP. My issue is that Power Apps does not recognize 'Title' the default single line text column inherent with every SP list. The formula throws an error saying it does not recognize the Title as a valid column in the SP list. The dropdownOppName.Selected.Title is working and retrieving the correct record so it's just the Title column is not recognized. Any recommendations?
Patch('Signatures', 'Title' = dropdownOppName.Selected.Title, {Status.Value: 'Contract Docs Received'})
How can you get this to work if your base sharepoint list is >10,000 records? Lookup() will only check the top 2000 rows or so won't it?
@v-qiuyu-msft - Thank you for the detailed response! You provided the solution as shown below.
Patch('Signatures',
LookUp('Signatures','Title' = dropdownOppName.Selected.Title),
{Status: {Value: "Contract Docs Receieved"}}
)
Hi @Anonymous,
Do you want to patch an existing record to you SP list?
Could you please share a bit more about the scenario?
Here is a standard Patch function, a base record is required if you want to update an existing record.
Patch( DataSource, BaseRecord, ChangeRecord1 [, ChangeRecord2, … ])
The formula you provided does not have a record, the parameter you referred in invalid.
'Title' = dropdownOppName.Selected.Title
Do you want to update the record that title has the Dropdown selected value?
Please modify your formula as below:
Patch('Signatures',
LookUp('Signatures','Title' = dropdownOppName.Selected.Title),
{Status: {Value:"xxx"}}
)
Note that you should update a Choice column as below
{ChoiceColumn:{Value:"xxx"}}
Note that you should specify a certain value rather than a column name for the Choice column.
Check if it helps.
Regards,
Qi
Thanks for the response. That dropdown menu has the Items property set to display OppName while also making related columns available and that is working as expected (see code below). The issue is Title is not recognized within the Patch() formula which is very odd behavior.
Filter(SortByColumns(ShowColumns(colSignatures, "OppName", "OppID", "Status", "DueDate", "SignatureName", "LegalRep", "Requestor", "Title"), "OppName"), Status.Value <> "Archived")
Does it work if you change
dropdownOppName.Selected.Title
to
dropdownOppName.Selected.Value
or
dropdownOppName.Selected.Result
WarrenBelz
89
Most Valuable Professional
MS.Ragavendar
60
stampcoin
48