cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

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
Highlighted
Solution Supplier
Solution Supplier

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
Highlighted
Solution Supplier
Solution Supplier

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.

Highlighted

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?

Solution Supplier
Solution Supplier

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?

Highlighted

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.

Highlighted
Solution Supplier
Solution Supplier

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

Highlighted

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
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (10,302)