cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KimberlyM
Level 8

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
cds
Level 8

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
cds
Level 8

Re: Patching to 2nd SharePoint List

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

KimberlyM
Level 8

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.

cds
Level 8

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

KimberlyM
Level 8

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
KimberlyM
Level 8

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

cds
Level 8

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

cds
Level 8

Re: Patching to 2nd SharePoint List

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

KimberlyM
Level 8

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

cds
Level 8

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,420)