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 / Highlight new items in...
Power Apps
Answered

Highlight new items in gallery depending on last login of user - show new item icon

(0) ShareShare
ReportReport
Posted on by 11

Hi Community,

 

I'm looking for some bright minds to solve the following problem.

I´m looking for a soluction to check if new items where uploaded to the app since last user login to highlight them. After next login the "highlight" icon, for example "new" should be invisible for this user. 

 

What is the starting point:

 

I have created the follwoing formula for the OnStart field of the App:

 

Set(lookupRecord; LookUp('App Logins'; Title = User().Email));; If(IsBlank(lookupRecord.Title); Patch('App Logins'; {Title: User().Email});Patch('App Logins';First(Filter('App Logins'; Title = User().Email)); {'Last Login': Now()}))

 

App Logins is a separated sharepoint list which is connected to the App and stores the logged in users without producing duplicates. When the user opens the app for the first time, then it is saved in the list. If the user already exist in the list, the "Last Login" field will be updated with the actual date and time. 

 

In my gallery i have inserted a icon with the following "visible" code:

 

If(LookUp('App Logins'; Title = User().Email).'Last Login' >= ThisItem.Modified;false;true)

 

So far so good. My problem is that the icon is only visible for a short time (time between the update of the "Last Login" field which automatially changes the Modified field in this list. 

That´s why I´m looking for ideas to solve the problem. One solution could be, to wait with the patch function for the App logins until user leaves the App.

 

Do you have an idea how to?

 

Categories:
  • Verified answer
    LaurensM Profile Picture
    12,516 Moderator on at

    Hi @PowerApp14,

     

    You will have to temporarily save the previous login record state before updating it in the OnStart. This is something you are actually already doing. This variable can then be referenced within your Visible code. I made some adjustments to your OnStart code and added inline comments to further explain the changes.

     

    Set(
     //Renamed variable - here we save the last login record if it exists
     gblLastLogin; 
     LookUp('App Logins'; Title = User().Email)
    );; 
    If(
     IsBlank(gblLastLogin.Title); 
     Patch(
     'App Logins'; 
     //Added Defaults
     Defaults('App Logins'); 
     {
     Title: User().Email
     }
     );
     Patch(
     'App Logins';
     //Use variable as record reference instead of First Filter
     gblLastLogin; 
     {'Last Login': Now()}
     )
    )

     

    Your Visible property will look as follows:

    //Only display when the user logs in for the first time or hasn't logged in since the record was modified
    IsBlank(gblLastLogin.'Last Login') || gblLastLogin.'Last Login' < ThisItem.Modified

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

  • PowerApp14 Profile Picture
    11 on at

    Hi LauransM,

    thank you very much, it works exactly as requested.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard