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 validate a Peop...
Power Apps
Answered

How to validate a People Combo Box is not empty or blank before patching to Sharepoint

(1) ShareShare
ReportReport
Posted on by 29
Scenario:
 
App to add and update records to a SP list. I am not using the standard forms but custom fields. One of the fields is a combo linked to a person field in the list.
 
All other fields on this screen validate fine so text fields, drop downs, dates and so on. It is just this combo.
 
The combo is called cboKeyContact. It's items come from the Sharepoint People column, and when I update this record, users have option to change the email in cboKeyContact.
 
But it needs to be populated or else I get a Patch error and that's what I am trying to trap.
 
I have tried the following:
 
If(cboKeyContact.Selected.Mail = "", // do stuff
 
If(IsBlank(cboKeyContact.SelectedItems, // do stuff
 
If(IsEmptyOrError(cboKeyContact.SelectedItems, // do stuff
 
If(Len(cboKeyContact.SearchText = 0, // do stuff

But none of these will trap an empty field.
 
So, does anyone know how I can validate a people combo please? I can validate other combos ok, but not a people combo for some reason.
 
Thanks
 
Categories:
  • Suggested answer
    CU18061035-1 Profile Picture
    Microsoft Employee on at
    hey
     
     
    you can try this:
    If(IsBlank(cboKeyContact.Selected), 
        
        Notify("Please select a contact.", NotificationType.Error), 
        
        Patch(...)
    )
    
    cbokeycontact.selected will give you the whole record of the people picker.
     
     
    if it helped please mark as verified answer,
     
     
    cheers
  • DaveMack Profile Picture
    29 on at
    Thanks, but that didn't work for me.
     
    This is the block of validation code on this field:
     
     If(IsBlank(cboKeyContact.Selected),
       Set( varMandatoryFieldCheck,
        true);
        UpdateContext({KeyContactEmailBorderColor: Color.Red})
    );
    So if it is blank it should update those variables - the context variable to change the border colour of the field. So this all takes place on the Update Record's OnSelect property and it should only perform the patch if varMandatoryFieldCheck is false. I added a label to test the value of that variable when I select the update button, and it does say false, but it should be true when the combo is empty. If I omit other fields on the screen, the label shows true as expected, so it validates other fields fine - just this combo.
  • Suggested answer
    CU18061035-1 Profile Picture
    Microsoft Employee on at
    hey
     
     
    thanks for trying.
     
    can u try this modification:
    If(
        IsBlank(cboKeyContact.Selected) || IsBlank(cboKeyContact.Selected.Email),
        Set(varMandatoryFieldCheck, true);
        UpdateContext({KeyContactEmailBorderColor: Color.Red}),
        Set(varMandatoryFieldCheck, false);
        UpdateContext({KeyContactEmailBorderColor: Color.Black}) // Reset color if valid
    )
    
    if it helped please mark as verified,
     
     
    cheers
  • Suggested answer
    SaiRT14 Profile Picture
    1,992 Super User 2025 Season 1 on at
    Check for blank:
    For a People Picker Combo Box linked to a SharePoint People column, the selected item should be checked using the IsBlank() function on Selected
    If(
       IsBlank(cboKeyContact.Selected),
       // Show error or block patch
       Notify("Please select a contact.", NotificationType.Error),
       // Proceed with Patch
       Patch(
          'YourSPList',
          Defaults('YourSPList'),
          {
             KeyContact: cboKeyContact.Selected
          }
       )
    )

     
     
    If the Combo Box (cboKeyContact) is linked to a People column, make sure the Items property
    cboKeyContact.Items = Office365Users.SearchUser({searchTerm: cboKeyContact.SearchText})
     
    Validate the field in your form’s OnSubmit action.
    If(
       IsBlank(cboKeyContact.Selected),
       Notify("Key Contact is required.", NotificationType.Error),
       SubmitForm(EditForm1)
    )
     
    Set AllowMultipleSelection to false if you want only one person to be selected.
     
    This should address your issue, pls let me know how it goes. 
  • Verified answer
    DaveMack Profile Picture
    29 on at
    Thanks again, but no luck.
     
    I tried this:
    If(
        IsBlank(cboKeyContact.Selected) || IsBlank(cboKeyContact.Selected.Mail),
        Set(varMandatoryFieldCheck, true);
        Set(varQuery, true);
        UpdateContext({KeyContactEmailBorderColor: Color.Red}),
        Set(varMandatoryFieldCheck, false);
         Set(varQuery, false);
        UpdateContext({KeyContactEmailBorderColor: Color.Black}) // Reset color if valid
    );
    I replaced Email with Mail and then added a new varQuery to check each condition. When I load the page with a populated combo, varQuery is true (correct - so that field is being validated). When I clear the field by deleting the person value and then trying to update again, varQuery remains true so it is still not detecting the field is empty

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 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard