Showing results for 
Search instead for 
Did you mean: 
Helper IV
Helper IV

Patching to 2nd SharePoint List

My Overall Goal:
I am trying to Patch "Notes" to my SharePoint List Lead_History.

My Process:
I have a main SharePoint list that contains all my Lead Data called Lead_Data but this list excludes my Lead_History (or notes) as there can be multiple entries per lead for this. 
I have a dashboard page that I click to display the Specfic Lead data which has a list at the bottom of all the history of notes. I want to be able from this same screen to be able to add to my history of notes.
I have added a textbox and I want to be able to patch this box by clicking on the + button rather than the checkmark in my top right corner. I want the user to see that the item is added to the gallery at the bottom of the screen.

The current code I have, that is not working is: 

Patch(Lead_History, Lead_History.LeadID = Gallery_Dashboard.Selected.ID, {Note: txt_HistoryDetail.Text, HistoryDate: Text( Now(), "[$-en-US]mm/dd/yyyy hh:mm:ss")});

It just keeps telling me there is an invalid argument but I have no idea what I am doing wrong. In my mind this should do what I want. 


Is anyone able to help me figure this out? I have a screen cap below to visualize what I am saying above.


Accepted Solutions
Impactful Individual
Impactful Individual

Patch(Datasource, Defaults(Datasource), {updates})


Defaults() will create a new item in list

View solution in original post

Impactful Individual
Impactful Individual

Patch(Lead_History, LeadID=Gallery.selected....)

If I remove the SharePoint list name, Lead_History.LeadID, and have it read as

LeadID = Gallery_Dashboard.Selected.ID,...

Then I get the error of the Name isn't valid. The identifier isn't recognized. As well as the same previous error of Patch having issues.

Impactful Individual
Impactful Individual

maybe try 
Patch(Lead_History, Lookup(Lead_History, Gallery.Selected=LeadID),{})

Also, is your DATE column a datevalue or text?

if it is date, use DateValue(Text(.....))

@cds Thank you. I am one step further. It is now posting but it keeps patching over itself, replacing the previous item (not doing completely as I expect). Each time the + is clicked I expect a new line to be created with the note information added to the lead.

Here is where I am not sure what is happening with the Lookup... 
The same line keeps being updated which is not what I want because I want a new line being created each time the + is selected but also noticed, as shown in my graphic, that the SharePoint list Created date is not showing today as the created date so I think it is only updating the last record not creating a new record. 

Impactful Individual
Impactful Individual

I am guessing you want a new line within the column, not a new item:


Patch(Lead_History, Lookup(xxxxxx), {HistoryDate: HistoryDate &"

" & Your information})

Impactful Individual
Impactful Individual

It is a good idea to end lines in columns with "; " (for split functions later in app dev)

What I want is for example (the current SharePoint Item I am on has an ID of 54)
Lead ID = 54
Note = This is my new note.
History Date = Text time stamp example 10/11/2019 11:42:59
Created = Actual Date/Time it was created not 2 day ago

Then the cell will reset and I can add another item in and it will patch again a new line
Lead ID = 54
Note = This is another new note.
History Date = Text time stamp example 10/11/2019 11:46:42
Created = Actual Date/Time it was created not 2 days ago.


Impactful Individual
Impactful Individual

I guess I don't understand.. Created is auto generated from sharepoint when new item is created...

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,950)