Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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:
  • calerof Profile Picture
    255 on at
    Re: Adding a record to a sharepoint list that includes the ID from another list

    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

  • OldDogNewTricks Profile Picture
    on at
    Re: Adding a record to a sharepoint list that includes the ID from another list

    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
    Re: Adding a record to a sharepoint list that includes the ID from another list

    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

  • TheRobRush Profile Picture
    11,121 Super User 2025 Season 1 on at
    Re: Adding a record to a sharepoint list that includes the ID from another list

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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,524 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,906 Most Valuable Professional

Leaderboard