I'm trying to add a note to a SharePoint List named NoteList. NoteList is defined as:
NoteList includes a Lookup Column, TicketID, which is related to the List TicketList where TicketList.ID is the unique identifier.
I've got a screen designed to add notes regarding a specific ticket. The screen I'm working from is called from a display of open tickets. The parent record (from TicketList) is defined as SelectedTicket. The screen that I'm working on includes these controls with the following attributes:
WorkTicketTicketID (text input with SelectedTicket.ID as it's Text attribute)
WorkTicketNoteTypeRadio (radio control with items defined as ["Internal","External"])
NewNoteInput (TextInput control where freeform note is entered)
I'm trying to patch this information to the NoteList SharePoint list with the following code:
Patch(NoteList,
{TicketID:SelectedTicket.ID,
DateTime:Now(),
NoteText:NewNoteInput.Value,
NoteType:WorkTicketNoteTypeRadio.Selected,
EnteredBy:CurrentUserEmail.ID
*/ }
);.
I'm having trouble with the proper syntax for the TicketID column. I get the following error:
I've tried a number of variations but can't land on the appropriate syntax.
Thank you in advance.
Right, here is your answer:
PATCH A SharePoint LookUp Column In Power Apps - Matthew Devaney
Patch(
NoteList,
Defaults(NoteList),
{
TicketID:
{Id: Gallery2.Selected.ID, Value: LookUp(NoteList, ID=Gallery2.Selected.ID, Title)},
Title: "Second123", Note: TextInput3.Text
}
)
Where Gallery2 has as Items your SharePoint List called: TicketList.
Cheers,
Fernando
I had initially tried that without success. To isolate the problem, I commented out the rest of the path just in case it was causing problems. Here's the message I'm getting using your recommendation.
Hi @OldDogNewTricks,
In your Patch formula, in:
{TicketID: SelectedTicket.ID
remove the ".ID" last part and leave SelectedTicket
This way you keep the record type of this selection.
Cheers,
Fernando
For reference, a lookup column is a record, so you cannot patch a simple value into it
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional