cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jamesbetteridge
Level: Powered On

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

Hi,

 

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.

 

James

1 ACCEPTED SOLUTION

Accepted Solutions
Edwin-Abdalian
Level 10

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

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

6 REPLIES 6
Edwin-Abdalian
Level 10

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

--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.

jamesbetteridge
Level: Powered On

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

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?

Edwin-Abdalian
Level 10

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

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?

jamesbetteridge
Level: Powered On

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

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.

Edwin-Abdalian
Level 10

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

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

jamesbetteridge
Level: Powered On

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

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,624)