Showing results for 
Search instead for 
Did you mean: 
Advocate I
Advocate I

Patch - Patching the current date to a Sharepoint List on Submit



I have two lists, a "Notes" list and a "Customer" list. I am trying to update a field in the Customer list (called "Date Last Contacted") based on the date a new note is added in the "Notes" list. Both lists have a customer identifier (Account Ref).


I am fairly new to PowerApps and so am assuming that Patch is the correct method for doing this?


If so, the patch statement I have so far is as follows:


Patch(Customer, LookUp(Customer, Gallery6.Selected.'Account Reference' in Customer.'Account Reference'), {Date_x0020_last_x0020_contacted: Today())}


This doesnt seem to show any errors but neither does it put today's date in the relevant Customer record.


Any help would be greately apprecaited.




Accepted Solutions

Then try this:

Patch('Customer Record', Lookup('Customer Record',Title = 'Form-Notes'.LastSubmit.'Sage Reference'), {Date_x0020_of_x0020_Last_x0020_C: Today()})

View solution in original post

Impactful Individual
Impactful Individual

--Edited ----

Forms in Canvas Apps have a property called LastSubmit. On your Notes form, and on its OnSuccess Property, use your Patch:

OnSuccess: Patch(Customer, Lookup('Customer', 'Account Reference' = NotesForm.LastSubmit.'Account Reference'), {Date_x0020_last_x0020_contacted: Today()}

**Replace NotesForm with your form name.


If this post helps, please choose Accept As Solution to help the other members, and give my post a Thumbs Up.

Thanks for your reply Edwin but I am still missing something. It's almost certainly me just not quite grasping Patch properly.


I've got the following code now in the OnSuccess property of the form (called 'Form-Notes'):


Patch('Customer Record', Title = 'Form-Notes'.LastSubmit.'Sage Reference', {Date_x0020_of_x0020_Last_x0020_C: Today()})


So "Customer Record" is my sharepoint list. "Title" is the original field name but was renamed to "Sage Ref" (i've tried both but without success :-S). 'Form-Notes' is the form I am adding this patch statement to and "Sage Reference" is what the auto complete suggested I use however, the account reference is in DataCardValue92(Text Input) of Sage Reference_DataCard5(DataCard).  Date_x0020_of_x0020_Last_x0020_C is the field name in the Customer Record sharepoint list although it shows a more friendly name of "Date of Last Call".


When I hover my mouse over the code is just says "The function Patch has some invalid arguments" or "Name isnt valid. The identifier isnt recognised" (This last error only shows when I hover over the word"Title" but doesnt alter if change "Title" to the current field name of "Sage Ref")


Can you see where I am going wrong?

do you use SubmitForm(Form-Notes) to insert/edit records to your Notes List? did you check that your Note list gets populated with the correct data?

Yeah, i'm using SubmitForm(Form-Notes) and the Form-notes list is getting updated. Only it that isnt working is the Patch of the current date into the 'Customer Record' sharepoint list.

Then try this:

Patch('Customer Record', Lookup('Customer Record',Title = 'Form-Notes'.LastSubmit.'Sage Reference'), {Date_x0020_of_x0020_Last_x0020_C: Today()})

Edwin, you are an absolute superstar! That's nailed it, thank  you so much for your help and your super quick replies.

Helpful resources

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (1,907)