cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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.
Capture_edit2.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Responsive Resident
Responsive Resident

Re: Patching to 2nd SharePoint List

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

 

Defaults() will create a new item in list

View solution in original post

13 REPLIES 13
Highlighted
Responsive Resident
Responsive Resident

Re: Patching to 2nd SharePoint List

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

Highlighted
Helper IV
Helper IV

Re: Patching to 2nd SharePoint List

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.

Responsive Resident
Responsive Resident

Re: Patching to 2nd SharePoint List

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

Highlighted
Helper IV
Helper IV

Re: Patching to 2nd SharePoint List

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

Highlighted
Helper IV
Helper IV

Re: Patching to 2nd SharePoint List

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

Highlighted
Responsive Resident
Responsive Resident

Re: Patching to 2nd SharePoint List

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

 

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

" & Your information})

Highlighted
Responsive Resident
Responsive Resident

Re: Patching to 2nd SharePoint List

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

Highlighted
Helper IV
Helper IV

Re: Patching to 2nd SharePoint List

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.

Capture_edit3.jpg

Highlighted
Responsive Resident
Responsive Resident

Re: Patching to 2nd SharePoint List

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

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

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

Top Solution Authors
Top Kudoed Authors
Users online (6,985)