Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

ComboBox DefaultSelectedItems Office365 User not found

(0) ShareShare
ReportReport
Posted on by

Hello

 

I'm pretty new to the whole Power Platform and i'm stuck, so any help would be appreciated.

 

I currently have a Combobox that is used to search and select a user to assign a task by using Office365Users.SearchUser.

The selected user is patched to a sharepoint list (Column: Assigned To) and saved in a people field, which works fine.

The user should stay selected in the Combobox for this specific entry, but can be manually changed if required and will then be patched to the sharepoint list.

Everything works fine for the first time the user is entered or changed, but if the task is updated without a change of user and i try to patch again, it tells me the user can't be found (The specified user i:0#.f|membership| could not be found.)

 

This is my patch function:

 

Patch(
 Batch_Tracker_Comments_1,
 ThisItem,
 {
 Page_Number: 'Input Page No.'.Text,
 Description: 'Input Description'.Text,
 Progress: 'Dropdown Progress'.Selected.Value,
 Category: 'Dropdown Category'.Selected.Value,
 Createx: VarCreated,
 Assigned: VarAssigned,
 Comment_Communicated: 'Date Communicated'.SelectedDate,
 Comment_Resolved: 'Date Resolved'.SelectedDate,
'Assigned To':{
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims:"i:0#.f|membership|" & 'Search Operations User'.Selected.Mail,
 Department:"",
 DisplayName:'Search Operations User'.Selected.DisplayName,
 Email:'Search Operations User'.Selected.Mail,
 JobTitle:"",
 Picture:""}
});
Refresh(Batch_Tracker_Comments_1);
Reset('Search QA User');
Reset('Search Operations User')

 

 

These are my Items for the ComboBox:

 

Office365Users.SearchUser({searchTerm:'Search Operations User'.SearchText})

 

 

DefaultSelectedItems:

 

ThisItem.'Assigned To'

 

 

I saw in another thread that "DefaultSelectedItems" just shows the default, but its not really selected.

I've been trying to resolve this issue for hours, but i'm stuck.

 

Thanks a lot in advance and kind regards

 

  • Verified answer
    v-jefferni Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @Phenokrates ,

     

    The V2 action would be better because V1 has been deprecated. But the two actions are basically the same. For your question, the two DisplayName for the LookUp function are case sensitive, so you'd better double check the display name values of your account from both ends, also you can try and use the Lower function to get rid of the case issue:

    Patch(
     Batch_Tracker_Comments_1,
     ThisItem,
     {
     Page_Number: 'Input Page No.'.Text,
     Description: 'Input Description'.Text,
     Progress: 'Dropdown Progress'.Selected.Value,
     Category: 'Dropdown Category'.Selected.Value,
     Createx: VarCreated,
     Assigned: VarAssigned,
     Comment_Communicated: 'Date Communicated'.SelectedDate,
     Comment_Resolved: 'Date Resolved'.SelectedDate,
    'Assigned To':{
     Claims:"i:0#.f|membership|" & LookUp(Office365Users.SearchUserV2().value,Lower(DisplayName) = Lower('Search Operations User'.Selected.DisplayName)).Mail,
     Department:"",
     DisplayName:'Search Operations User'.Selected.DisplayName,
     Email:LookUp(Office365Users.SearchUserV2().value,Lower(DisplayName) = Lower('Search Operations User'.Selected.DisplayName)).Mail,
     JobTitle:"",
     Picture:""}
    });
    Refresh(Batch_Tracker_Comments_1);
    Reset('Search QA User');
    Reset('Search Operations User')

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Phenokrates Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @v-jefferni 

     

    This works for some accounts like i want it to, but if i try to assign mine, it tells me it cant find the user. I'm not sure why that happens, maybe i gotta take a look at the user accounts and compare them.

     

    Is the below for the items in the combobox still ok or would it need to be updated to use SearchUserV2?

     

    Office365Users.SearchUser({searchTerm:'Search Operations User'.SearchText})

    Kind regards

    Phenokrates 

  • v-jefferni Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @Phenokrates ,

     

    As the two Combo boxes are in the Gallery, the above solution is useless for your scenario. After testing with a Gallery as well as Combo boxes in it, I found the issue is coming from the Mail column, the app could not retrieve the Mail value from the source after a Patch:

    vjefferni_1-1651049927557.png

     

    So as the workaround, we could try and get the email using a LookUp function:

    Patch(
     Batch_Tracker_Comments_1,
     ThisItem,
     {
     Page_Number: 'Input Page No.'.Text,
     Description: 'Input Description'.Text,
     Progress: 'Dropdown Progress'.Selected.Value,
     Category: 'Dropdown Category'.Selected.Value,
     Createx: VarCreated,
     Assigned: VarAssigned,
     Comment_Communicated: 'Date Communicated'.SelectedDate,
     Comment_Resolved: 'Date Resolved'.SelectedDate,
    'Assigned To':{
     Claims:"i:0#.f|membership|" & LookUp(Office365Users.SearchUserV2().value,DisplayName ='Search Operations User'.Selected.DisplayName).Mail,
     Department:"",
     DisplayName:'Search Operations User'.Selected.DisplayName,
     Email:LookUp(Office365Users.SearchUserV2().value,DisplayName ='Search Operations User'.Selected.DisplayName).Mail,
     JobTitle:"",
     Picture:""}
    });
    Refresh(Batch_Tracker_Comments_1);
    Reset('Search QA User');
    Reset('Search Operations User')

     

    Collections or variables are not required any more.

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Phenokrates Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hello @v-jefferni 

     

    This first screenshot is prior to saving the entry, as you can see, for comment 22 and 24, someone was assigned for both assigned to and QA rep.

    Office 365 User Issue prior save.png

     

    Here, the QA rep was changed and saved in comment 22. This also changes the selection in the QA rep combobox for comment 24. It doesn't save it to the sharepoint list until someone hits the savebutton for comment 24, but it would be my goal to always show the currently assigned person for both "assigned to" and "QA Rep" according to the sharepoint list.

    Office 365 User Issue post save.png

    i hope this helped.

     

    Thanks a lot for your continued input

    Kind regards

    Phenokrates

  • v-jefferni Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @Phenokrates ,

     

    I cannot understand your scenario, could you please share some screenshots?

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Phenokrates Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @v-jefferni 

     

    You were right, it worked.

     

    The issue that came up with this solution is that i have multiple comments on a single page for users to scroll through. And if one responsible person is changed, it changes the shown value for all of them.

    I have used "colUser" as DefaultSelectedItem now to show the currently selected responsible person but i only want the shown person to change for the entry that's currently processed.

     

    Kind regards

    Phenokrates

     

  • v-jefferni Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @Phenokrates ,

     

    Check the formula again:

    ClearCollect(colUser, 'Search Operations User'.Selected)

    This error message always comes from typos in the collect function.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Phenokrates Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @v-jefferni 

     

    The app will be used to add a comment to a document tracker. The comment is assigned to a responsible person by a quality person. 

    The responsible person will afterwards open the entry in the app, maybe add a comment, or change a progress dropdown menu, and will save again without touching the "assigned to" combobox.

     

    I tried your solution above, but colUser is giving me an error, its not recognized.

     

    Thanks a lot for any suggestions

    Kind regards

    Phenokrates

  • v-jefferni Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hi @Phenokrates ,

     

    Will the user navigates to other screens after once submission? If yes, then you need to use a collection instead of a context variable:

    ClearCollect(colUser,'Search Operations User'.Selected)

     

    Patch(
     Batch_Tracker_Comments_1,
     ThisItem,
     {
     Page_Number: 'Input Page No.'.Text,
     Description: 'Input Description'.Text,
     Progress: 'Dropdown Progress'.Selected.Value,
     Category: 'Dropdown Category'.Selected.Value,
     Createx: VarCreated,
     Assigned: VarAssigned,
     Comment_Communicated: 'Date Communicated'.SelectedDate,
     Comment_Resolved: 'Date Resolved'.SelectedDate,
    'Assigned To':{
     Claims:"i:0#.f|membership|" & First(colUser).Mail,
     Department:"",
     DisplayName:First(colUser).DisplayName,
     Email:First(colUser).Mail,
     JobTitle:"",
     Picture:""}
    });
    Refresh(Batch_Tracker_Comments_1);
    Reset('Search QA User');
    Reset('Search Operations User')

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Phenokrates Profile Picture
    on at
    Re: ComboBox DefaultSelectedItems Office365 User not found

    Hello @v-jefferni 

     

    I tried your suggestion, but i'm unfortunately still getting the same error message.

     

    Kind regards

    Phenokrates

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,700 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard