Showing results for 
Search instead for 
Did you mean: 
Helper I
Helper 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

Solution Supplier
Solution Supplier

--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()})

View solution in original post

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

Helpful resources

PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!


Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (41,200)