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 / How to set the lookup ...
Power Apps
Answered

How to set the lookup field of 1 form to be the id of another form after submitting the form?

(0) ShareShare
ReportReport
Posted on by 166

I have 2 lists connected to my Power Apps. Both are added as new forms to the power app. But the 2nd list has a lookup column to the first list. I want the user to submit the new record to the first list first. Then automatically grab the newly created ID and set it as the lookup column on that 2nd list new form so that when they submit that 2nd form to create a new item, it will just be linked to the item created in the first list.

 

To do this, I tried to edit the default value of the lookup to be "Form_PersonalInfo.LastSubmit" (this is the first form), and the button that submits it looks like "SubmitForm(Form_PersonalInfo);" The form on success event is "Navigate(Screen_AdditionalTravelers, ScreenTransition.Cover);".  However it doesn't work. I get an error saying "An entry is required or has an invalid value. Please correct and try again".

 

Anyone know how to do this?

Categories:
  • Roma Gupta Profile Picture
    167 on at

    @R58395 - try Navigate(Screen5, ScreenTransition.Cover,{selectedId: <yourGalleryName>.Selected})

  • R58395 Profile Picture
    166 on at

    Why do selected though? In my case I'm not selecting items from any list, I'm submitting a form to create an item.

  • Verified answer
    Roma Gupta Profile Picture
    167 on at

    @R58395 selectedId: <yourGalleryName>.Selected.ID

    set selectedId on Item of second screen gallery where you want to set the value

  • Roma Gupta Profile Picture
    167 on at

    selectedId is just a name, it will give you record that was just submitted as an object

  • R58395 Profile Picture
    166 on at

    What would I put here <yourGalleryName>? I have no gallery components. I only have EditForm components.

  • Roma Gupta Profile Picture
    167 on at

    @R58395 - you directly want to take user to edit screen after a record is submit to set lookup value right?

     

  • R58395 Profile Picture
    166 on at

    Do I need to pass that in the Navigate formula as an argument, or can I just put that formula directly in the 2nd form default value?  

    Also the text field is a lookup value in a SP list. I don't see any field for default value for the text field. Is there a formula specifically for lookup fields?

  • Roma Gupta Profile Picture
    167 on at

    @R58395 - Please could you test this on a test label first. 

    When you submit the form, set a variable. Last Submit should give you last save record.

    SubmitForm(Form1); Set(variable1, Form1.LastSubmit)

     

    Set text property of label to variable.<column name>

    I tested on Firstname column & it shows me value post submit operation. 

     

    If that happens , you can use the variable in edit form for setting up lookup value

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard