web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Adding a record to a s...
Power Apps
Unanswered

Adding a record to a sharepoint list that includes the ID from another list

(0) ShareShare
ReportReport
Posted on by

I'm trying to add a note to a SharePoint List named NoteList.  NoteList is defined as:

OldDogNewTricks_0-1693335587910.png

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:

OldDogNewTricks_1-1693336595087.png

I've tried a number of variations but can't land on the appropriate syntax.

 

Thank you in advance.

 

 

 

 

 

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    For reference, a lookup column is a record, so you cannot patch a simple value into it

  • calerof Profile Picture
    255 on at

    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

  • OldDogNewTricks Profile Picture
    on at

    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.

    OldDogNewTricks_1-1693343221179.png

     

  • calerof Profile Picture
    255 on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard