Search code examples
sharepointpowerapps

How to set a Sharepoint lookup field when inserting a new record in PowerApps


I am using the Collect function to insert a new record into a Sharepoint list using PowerApps. There is a Gallery with a list of values from another Sharepoint List. I want to use the Selected value from the Gallery to set one of the fields in the Insert List.

I thought it would be as easy as this:

Collect('Concert Log List',{Attendee: BrowseGallery1.Selected});

Essentially I want to add a new record to the Content Log List and reference the Attendee (which is the lookup list) every time the Attendee is referenced. Now the field just ends up being blank.


Solution

  • Got it:

    Patch('Child List',
      Defaults('Child List'), 
      {
        Title:"test",
        ParentItem:
          {
            Id:Gallery1.Selected.ID,
            Value:Gallery1.Selected.Title
          }
      }
    )