web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : rGOSo0LBouQLTthYEE1bWX
Power Apps - Building Power Apps
Unanswered

Find Default user using User().Email and comparing to two SPO Lists

Like (0) ShareShare
ReportReport
Posted on 17 Jan 2022 16:46:17 by 278

@RandyHayes I accepted the solution in the other thread and am starting this one up as my path forward has changed, and I wanted to be clear on the ask I have.  The other thread got confusing cause I was changing how I wanted to set it up.

 

Two SPO Lists.

Assignements

Engineers

Assignments has an AssignedTo column, that is a lookup column to Engineers.Title.

Engineers.Title has the SMTP address of the user.

I have found that for some of my users, Teams does NOT use the primary SMTP of the user.

So for some of my users, User().Email will NOT match Engineers.Title.

So what I did was create another column in Engineers called UPN.  Added that secondary email there.

Here is what I am trying to accomplish now.

Travis5150_0-1642437540930.pngTravis5150_1-1642437560879.png

Travis5150_2-1642437601923.png

 

Currently, when a user comes in, they can search for their address.

What I want is for the current user to hit this screen, and there is no search or list, it is just defaulted to their email address.  They no longer get the option to search or a list of users.  It is just automatically filled with their Primary SMTP.

 

I figured the only way to do this was to somehow grab User().Email in PowerApps.

Lookup Engineer.UPN and where it matches User().Email, it should RETURN Engineer.Title as the defaulted user.

 

I have tried this a few different ways.  I keep running into issues like you can't compare text to record, etc.  My searches always fail because I think User().Email is text.  I even tried inputing that into a hidden text input and trying to compare, still would not work.

At one point, I believe I switched the datacard to a datasource of Engineers.  I was able to get the user to default, but when I went to submit the data to Assignments, it would post everything except AssignedTo.  I did not understand why this was happening.

 

So, is this possible and if so, what is the best way to go about this?

  • Travis5150 Profile Picture
    278 on 18 Jan 2022 at 01:34:18
    Re: Find Default user using User().Email and comparing to two SPO Lists

    Correct, and sorry.  I am the one that caused all the confusion.

     

    Yes, if we can get it so it does nothing else but defaults to the current user, that would be great.

    If that is not possible, then it defaulting to the current user, with the ability to pick someone else would be fine.

     

    Thanks again man, I will catch you tomorrow.

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 18 Jan 2022 at 01:27:33
    Re: Find Default user using User().Email and comparing to two SPO Lists

    @Travis5150 

    Hmmm, then I'm a little confused on the purpose of the combobox.  I thought you wanted the ability to search for other users to change the assigned to?

    Are you not wanting the capability to choose other assigned to users?

     

    (BTW: I'm wrapping for the night...so I will get back to you tomorrow on your response)

  • Travis5150 Profile Picture
    278 on 18 Jan 2022 at 01:06:35
    Re: Find Default user using User().Email and comparing to two SPO Lists

    Yep, that worked.  I still have the ability to choose others.

    It populates with the correct title, but if I click the drop down, I can still search for others (would rather not have that if possible).

     

    Travis5150_0-1642467946548.png

    And it posted to the SPO List!!

  • Travis5150 Profile Picture
    278 on 18 Jan 2022 at 01:01:04
    Re: Find Default user using User().Email and comparing to two SPO Lists

    Where you want that at?

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 18 Jan 2022 at 00:54:04
    Re: Find Default user using User().Email and comparing to two SPO Lists

    @Travis5150 

    So then we need to determine if the DSI is producing a record.  Let's short-circuit it and use this formula:

    LookUp(Engineers, Title="enter a known title here")

    See if that at least has the correct user for the known user selected.

  • Travis5150 Profile Picture
    278 on 18 Jan 2022 at 00:50:29
    Re: Find Default user using User().Email and comparing to two SPO Lists

    @RandyHayes  so that brings back the list of engineers, it doesnt just prepopulate the box with the current user.

    We want to have it so nothing shows up, except for the current user Engineer.Title.

     

    Travis5150_0-1642466933976.pngTravis5150_1-1642466955741.png

     

    Travis5150_2-1642467022247.png

     

  • RandyHayes Profile Picture
    76,287 Super User 2024 Season 1 on 18 Jan 2022 at 00:40:11
    Re: Find Default user using User().Email and comparing to two SPO Lists

    @Travis5150 

    Adding another lookup column for the UPN is only going to complicate things even more.

     

    That filter formula you have is restricting all the table results to just an AssignedTo column.  You need to have the ID and Title of the Engineers list in order to generate your Lookup value in the Update.  So, your Items property needs to provide it.

     

    Your Items property on the Combobox should be: Engineers

    The DefaultSelectedItems property should be:  

    Coalesce(
     LookUp(Engineers, 
     StartsWith(Title, ThisItem.AssignedTo.Value) || StartsWith(UPN, ThisItem.AssignedTo.Value)
     ), 
    
     LookUp(Engineers,
     StartsWith(Title, User().Email) || StartsWith(UPN, User().Email)
     )
    )
    
     

    Your DisplayField should be ["Title"]

     

    Your Update property on the AssignedTo_DataCard2 needs to be:

        With(DataCardValue11.Selected, {Id: ID, Value: Title})

     

    That should be all you need.  Try them out exactly like above and see where you get.

  • Travis5150 Profile Picture
    278 on 18 Jan 2022 at 00:31:13
    Re: Find Default user using User().Email and comparing to two SPO Lists

    @RandyHayes  kind of back where I started of getting no results.

     

    So, to eliminate the need to look at the Engineers list, I created that other lookup column.

    So now, Assignments List has...

    AssignedTo which is a lookup to Engineers.Title

    UPN which is a lookup to Engineers.UPN

     

    Working with this filter but getting no results

     

    Filter([@Assignments],UPN.Value = User().Email).AssignedTo

  • Travis5150 Profile Picture
    278 on 18 Jan 2022 at 00:04:14
    Re: Find Default user using User().Email and comparing to two SPO Lists

    I think I can make things easier.  

    For the Assignments.AssignedTo column, it is a lookup column to Engineers.Title.

    In SPO, I added an additional column to look up, UPN.

    It then added another column for UPN, and is pulling back Engineers.UPN.  

    So we should be able to focus on just this SPO list, Assignments.

     

    Travis5150_0-1642464246232.png

     

  • Travis5150 Profile Picture
    278 on 17 Jan 2022 at 21:55:36
    Re: Find Default user using User().Email and comparing to two SPO Lists

    @RandyHayes , Ok, I got a bit closer.

    So I THINK I got the items to filter on User().email, compare it to UPN and RETURN Title.

    When I did it this way, The only choice to choose from was the correct choice, but I still had to choose it.

    I tried a few combinations in the DefaultSelectedItems as well as Default, but nothing worked, kept getting errors.

    The other thing is, like before, when I click on Submit, it creates the SPO record in Assignments, but it does NOT enter in the AssignedTo field, which is the SMTP.

    Travis5150_0-1642456393795.png

     

    Travis5150_5-1642456607852.png

     

     

     

    Travis5150_1-1642456415026.png

     

    Travis5150_2-1642456446825.pngTravis5150_3-1642456464117.png

     

    Travis5150_4-1642456527282.png

     

     

     

     

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete