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

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard