Hi Hivemind!
So I have a combobox search using the Office365Users connector that has this code for the items:
Filter(Office365Users.SearchUser({searchTerm:ComboBox1.SearchText}), AccountEnabled = true)
This gives me a list of names i can search of people within my org. I have another field on the screen to automatically display information like email, address, etc. However those fields (email as an example) looks like this:
If(Not(IsBlank(ComboBox1.Selected.DisplayName)), First(Office365Users.SearchUser({searchTerm:ComboBox1.Selected.Id})).Mail)
My Issue is there is someone in our org (and possibly others) that have 2 accounts. So if I select one of the options in the first drop down the email displays, but if i select the second person the email is wrong because the email field is matching on the first match to the name.
I understand the issue, but is there a way to search by the ID selected in the combobox that way all these other fields will match and be the information for the row i'm selecting in the first drop down for people with the exact same name?
Thank you for the help on how to go about this!
That did it! Big oversight on my part. Thank you so much!!
@Nicci ,
If you get rid of .DIsplayName on the end and simply display this in the combo box properties, the rest of the user's details should be available without actually selecting.
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. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
Its set to the logged in user, like this:
Filter(Office365Users.SearchUser({searchTerm:Office365Users.MyProfile().DisplayName}), AccountEnabled = true).DisplayName
The combobox is changeable if the user is filling out the form on behalf of someone like their supervisor.
When it's this case the Coelesce will work because you're clicking someone else, however for 99% of the time the defaulted user who is logged in is the one filling it out and now the rest of the fields like email are not pre- populating.
Also the way it gets the current user is by doing a search user function of the profile by displayname, which i'd be very curious if the person with the same name as another employee would get the correct ID if she were to log in. I dont have a way for her to test that at this point, but I betcha it just uses the first match or maybe causes and error because 2 results would come back. Not sure.
Ah actually because I prepopulate the name in the first combobox, the coelesce is not triggering because you need to click it. Is there a way to do this by just pre populating everything? Most of the time people are going to leave it to the default logged in user name and email and everything should prefill, but sometimes it is filled out on behalf of someone else, so when searching for names and selecting the person who shares the same name with another employee is where the issue is. I need it to pre populate based on what is in the combo box.
It seems the way it works is nothing is pre populated even though there is a selected name already unless i remove and select it again which is tedious.
This worked perfectly! I didnt even need the ID as a second column. I was trying to redo the search to auto fill and didnt realize you can use coalesce from the combobox so it just prefills the one you selected!!! Thank you!
Hi @Nicci ,
One way of finding the right entity is to have a two column combo box
with the Items
Filter(
Office365Users.SearchUser({searchTerm: Self.SearchText}),
AccountEnabled = true
)
ansd then your result (the message can be "" if you do not want one)
Coalesce(
ComboBox1.Selected.Mail,
"Message Here"
)
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. If the content was useful in other ways, please consider giving it Thumbs Up.
MVP (Business Applications) Visit my blog Practical Power Apps
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional