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 / On AppStart: find the ...
Power Apps
Answered

On AppStart: find the ID from a SP table where the email adress is the same as the logged inn O365 user and then store the id as a var

(0) ShareShare
ReportReport
Posted on by 77

Hi.

 

I have a list in SP Online with columns for ID, Name and email adress. When the app starts I want to find a match between User().EMail() and the email adress in the table, and then store the ID from the table as a variable to use later in the app.  

 

Whats the best method to get this done?

 

Thanks in advance

Categories:
I have the same question (0)
  • SkiDK Profile Picture
    1,016 on at

    Hi @PowerTegga 

    You can put this in OnStart:

     

    Set(UserId, LookUp(SP_List, Email = User().Email, ID))

     

     Maybe a better idea is to create an object of your user, so you can always access all of your user information that comes from SharePoint, simply like this:

     

    Set(User, LookUp(SP_List, Email = User().Email))
    You can then access id by: User.ID as well as all other information that comes from your SP list

     

    Hope this helps! 

  • PowerTegga Profile Picture
    77 on at

    Thank you for your answer, @SkiDK .

     

    Your answer sounded like a good idea, but there seems to be a problem with this. See the strange error in my attachment. This is when I put the mouse over the Lookup function.

     

    Do you have any idea what might cause this?

     
    2020-06-18_21-06-20.png
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @SkiDK ,

     

    It is not suggested to apply the User() function into the formula directly, please try with this:

    Set(VarUser, User().Email); Set(VarID,LookUp('SP list', Email = VarUser.Email).ID) 

    Hope this helps.
    Sik

  • SkiDK Profile Picture
    1,016 on at

    Hi @PowerTegga 

    That's a weird error. What is the result if you do next:

     

    LookUp(gmPersoner, Email = User().Email).ID

     

    But as @v-siky-msft says, it is better to first store current user in a variable and then to use that object. Works for delegation and it also will be more performant. So what is the result if you try next: 

     

    Set(varUser, User());
    Set(varUserId, LookUp(gmPersoner, Email = varUser.Email).ID);

     

    If that doesn't work, could you show the structure of 'gmPersoner', and if its a collection where and how it's initiated?

  • PowerTegga Profile Picture
    77 on at

    I found out that the problem was that I needed to save and close the app first. When I opened it again it was all good. I guess thats because the function is placed in "App" (Startup).

     

    Thanks both of you.

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 339 Most Valuable Professional

#2
11manish Profile Picture

11manish 180

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard