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 / Default selected items...
Power Apps
Unanswered

Default selected items based on a lookup field

(1) ShareShare
ReportReport
Posted on by 4

Hi! I have a list in SharePoint that contains several fields. Users fill out these fields, and based on the values they enter, the default values for fields in another list need to be populated automatically. The two lists are connected by a Lookup field called “Request Number”. Users can submit the initial list multiple times, and each time, the values from the most recently submitted item should be transferred to the second list. However, I am facing an issue where the values from the first submitted item are being transferred instead of the most recent one. the thing is if the request number is different the latest values are transferred but if user use the same request number, values from the first item created with that request number is transferred not the last one. How can I resolve this in PowerApps?

Here are more details about the second form: OnSelect property of  NewForm button in the gallery is set to: 

NewForm(Form2);Set(Varnum,"now"); Set(VarSpecial, First(Sort('Form1',Created,SortOrder.Descending))); Navigate(Form2Screen);

I put a label in the form2 to get the value and Id of the request number of latest record from form1: Label1 for value: 

First(Sort('Form1',Created,SortOrder.Descending)).'Request No.'

and Id in label2 : 

First(Sort('Form1',Created,SortOrder.Descending)).ID

and defaultSelecteditems for Request number : 

If(Varnum = "now", {Id: Label2.Text, Value: Label1.Text },Parent.Default)

 

any help would be appreciated. 

thank you

Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,974 Moderator on at

    Hi @haleht 

     

    Please for the love of my eyeballs and brain matter (The little I have left) don't post code as if its a paragraph

     

    Use the Code Snippet feature </> and for each one only explain that line or at east use some spaces.


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

  • haleht Profile Picture
    4 on at

    I just modified it, is it better now?

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 602

#2
WarrenBelz Profile Picture

WarrenBelz 473 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 310

Last 30 days Overall leaderboard