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 / Patching a defaulted s...
Power Apps
Answered

Patching a defaulted selected item in combo box

(0) ShareShare
ReportReport
Posted on by 217 Season of Giving Solutions 2025
I have a combo box (cb_lineManager) that is a lookup to a person field in a sharepoint list.  This field will be defaulted to a value from another list or the user can delete that value and select another from the dropdown of users listed.  
The defaultedSelectedItems for the field is like so;
 
 
If(varNewApplication,First(myPersonalDetails).lineManager,
CurrentItem.Line_Manager)
 
 
My problem is, if I want to take a value from that field to patch, like so - cb_lineManager.Selected.Mail it will be blank as I assume nothing is selected, its defaulted instead.
Any solutions?
 
 
 
I have the same question (0)
  • Suggested answer
    MS.Ragavendar Profile Picture
    7,249 Super User 2026 Season 1 on at
    Hi @senna,
     
    The issue is that cb_lineManager.Selected.Mail only works when a user actively selects an item. However, since you're using DefaultSelectedItems, the selection is not explicitly made by the user, so Selected does not capture it.
     
    Use SelectedItems Instead of Selected
     
    Patch(
        YourSharePointList,
        Defaults(YourSharePointList),
        {
            Line_Manager: First(cb_lineManager.SelectedItems).Mail
        }
    )
     
    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item

     
  • MS.Ragavendar Profile Picture
    7,249 Super User 2026 Season 1 on at
     
    You can explicitly set the selection in the Combo Box
     
    In the screen’s OnVisible property
    • Set(varDefaultLineManager, LookUp(myPersonalDetails, YourCondition).lineManager)
    Assign This Variable to DefaultSelectedItems
    • If(varNewApplication, [varDefaultLineManager], [CurrentItem.Line_Manager] )
       
    Patch remains the same. 
     
    Hope it helps!
     
  • senna Profile Picture
    217 Season of Giving Solutions 2025 on at
    @MSR@08012015 thanks for that replay.
    I've tried using the variable varDefaultLineManager and that will work for most of the use case, but the user can manually change the combo box to a different user, so I just need to handle that, i was thinking something like onChange of the combo box using 
     
    Set(varSwyDefaultLineManager, Self.Selected)
     
    but that doesn't seem to update the variable to what the user has now selected?  
  • MS.Ragavendar Profile Picture
    7,249 Super User 2026 Season 1 on at
     
    You need to update the variable only if the user selects a new value, but also retain the default value if they do not select anything
     
    Set(varSwyDefaultLineManager, cb_lineManager.Selected)
     
    DefaultSelectedItems 
     
    If(
        !IsBlank(varSwyDefaultLineManager), 
        [varSwyDefaultLineManager],  // Use user selection if available
        If(varNewApplication, [varDefaultLineManager], [CurrentItem.Line_Manager]) // Use default otherwise
    )
     
    Patch
     
    Patch(
        YourSharePointList,
        Defaults(YourSharePointList),
        {
            Line_Manager: First(cb_lineManager.SelectedItems).Mail
        }
    )
     
    revert me if doesn't work.
  • senna Profile Picture
    217 Season of Giving Solutions 2025 on at
    @MSR@08012015 thanks again for the response.
     
    Where are you placing this line 
     
    Set(varSwyDefaultLineManager, cb_lineManager.Selected)
     
    I'm also aware i have interchanged varSwyDefaultLineManager and varDefaultLineManager, those are just 1 variable in my code, maybe I need 2 variables here?  
  • Verified answer
    MS.Ragavendar Profile Picture
    7,249 Super User 2026 Season 1 on at
     
    The set variable in the OnChange of ComboBox.
     
    No, you don’t necessarily need two variables. However, using two can provide meaningful experience in the code maintenance.
    • varDefaultLineManager → Stores the default value (from another list or record).
    • varSwyDefaultLineManager → Stores the user-selected value.
     
    If you keep just one variable (varSwyDefaultLineManager), then modify DefaultSelectedItems like this
     
    DefaultSelectedItems = 
    If(
        !IsBlank(varSwyDefaultLineManager), 
        [varSwyDefaultLineManager],  // Use user-selected value
        If(varNewApplication, [First(myPersonalDetails).lineManager], [CurrentItem.Line_Manager]) // Use default if nothing is selected
    )
    
     
    Hope this helps!
  • senna Profile Picture
    217 Season of Giving Solutions 2025 on at
      Thank you @MSR@08012015
     
    I was pulling my hair out and then I realised i was using "varSwyDefaultLineManager.Email" and getting a blank so assumed the variable was not set as I knew the user selected had an email address.  But when I changed it to "varSwyDefaultLineManager.Mail" it now displays their email!!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 408

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 319

Last 30 days Overall leaderboard