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 Dropdown contr...
Power Apps
Answered

Default Dropdown control to current user's last selection

(0) ShareShare
ReportReport
Posted on by 30

I have a desk booking canvas power app that works perfectly (yey).  Then I was asked if the office location dropdown selection could just default to the current user's last selection?  So, if the current user selected Denver when they used the app a month ago, when they go to use the app again (in a browser or on a cell phone), it recognizes them and displays the office location they last selected.  I've been researching, testing, failing, repeat for weeks and am exhausting all resources.  Any help is greatly appreciated!  All the data is stored in Sharepoint, every completed desk reservation is recorded to a reservation list, and the Locations are in their own Sharepoint list as Choices (allowing only one selection).  Thank you!  

Categories:
I have the same question (0)
  • rpersad Profile Picture
    831 on at

    What you can do is lookup in the sharepoint list the last record submitted by the user and get the Location and set it as the Default value.

  • Devvj Profile Picture
    1,132 Super User 2024 Season 1 on at

    Hi @AppNewbie 

     

    You could probably use something with this or similar logic

     

    FirstN(Sort(Filter('Reservation Table', Owner = User().Email), Created, Descending), 1).Locations.Value

     

    You ofc need to tweak some of the names 🙂
    But hopefully you can get some idea out of the example above

     

  • AppNewbie Profile Picture
    30 on at

    Thank you, however I don't know how to write a lookup nor do I know where that should go in the app.  Can you please assist further?

  • AppNewbie Profile Picture
    30 on at

    Thank you.  I tried your solution, placing it in the Default control for that field and it didn't work.  I really don't know how to customize this to my data.  The table is called Desk Reservations, the office locations are in a list called Locations (which is populating the drop down), the column in the table is also named Locations.  The user's name goes in a column called ReservedBy, and when I try to sort the Modified column (as you have) the whole thing creates an error.

  • Verified answer
    rpersad Profile Picture
    831 on at

    Try

    Last(Filter('Desk Reservations', ReservedBy.Email = User().Email)).Locations
    • The Last function gets the last record in the List.
    • The filter function searches for all records where the ReservedBy email is equal to the active user's email. NOTE: This is assuming the ReservedBy column is a people picker column. If it is a Text field you would have to compare the column with the value User().FullName. Though I would suggest to use a people picker and compare using emails given that their emails would always be unique but there can have multiple people with the same name.
    • The .Locations will return the value in the Locations column.

     

  • AppNewbie Profile Picture
    30 on at

    rpersad, you are a LIFE SAVER!  This worked perfectly!  Thank you so much for the code and the great explanation, you made my day...and more!

  • rpersad Profile Picture
    831 on at

    No problem glad I could help 👍

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard