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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Best way to detect the...
Power Apps
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 264

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
    153,032 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
    264 on at

    Document Library

  • pal95 Profile Picture
    264 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
    153,032 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard