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 / Best way to detect the...
Power Apps
Answered

Best way to detect the highest ID number in SharePoint when uploading pictures from PowerApps

(0) ShareShare
ReportReport
Posted on by 266

Hi, I am looking for the best way to detect the highest ID number in SharePoint when uploading pictures from PowerApps.

 

I must keep a pattern for pictures and I can't use a random number, it must be a picture number in the end, so something like:
photo_1
photo_2
photo_3

etc.


I am using Power Automate to upload them and ask for name in PowerApps, but when I use the Max() + 1 function, sometimes it doesn't detect the last record if the user uploads pictures too fast and a picture is lost.

 

I also struggle with offline function, as sometimes the user would upload pictures offline. I think it should read the values from SharePoint but as above, sometimes it doesn't detect the last record.

 

Any ideas for workarounds? Thank you!

Categories:
I have the same question (0)
  • BhargavPatel Profile Picture
    660 Moderator on at

    When you say SharePoint do you mean List or Document Library?

     

  • WarrenBelz Profile Picture
    154,799 Most Valuable Professional on at

    Hi @pal95 ,

    The easiest way of getting the last ID is 

    First(
     Sort(
     DataSource,
     ID
     SortOrder.Descending
     )
    ).ID

     

    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

  • pal95 Profile Picture
    266 on at

    Document Library

  • pal95 Profile Picture
    266 on at

    This doesn't catch the last ID if users are uploading pictures very fast (like a few in 1 minute)

  • VishalJhaveri Profile Picture
    1,167 Moderator on at
    First( 
     Sort(
     Source,
     ID
     Descending
     )).ID
  • BhargavPatel Profile Picture
    660 Moderator on at

    @pal95 How about appending the ID of the file itself to the file name in the flow, instead of Max( )+1?

  • Verified answer
    WarrenBelz Profile Picture
    154,799 Most Valuable Professional on at

    @pal95 ,

    It should show that latest ID except for maybe a few seconds "gap" and there is really no solution for concurrent users.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 530

#2
WarrenBelz Profile Picture

WarrenBelz 459 Most Valuable Professional

#3
Haque Profile Picture

Haque 314

Last 30 days Overall leaderboard