Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

How to assign the next custom ID using SP and Power Automate

Posted on April 23, 2023April 23, 2023 by Tom

“I’m creating custom id for each new SP item, how do I get the latest one so I can increment it within Power Automate flow?”


When creating basically any data (not only in SharePoint), you should always have a unique ID. It’s so much easier to reference a specific entry / request / anything if you can share just a single, unique value!

While SharePoint assigns their own ID to everything, it’s often not in the format you might like. It’s just a number, nothing else, and it starts from 1 in each list you use. No fixed length, no letters referencing the solution, only a number. Yet an ID like REQ-0001 might look so much better than just 1.

Utilise the SharePoint ID

One way to create a unique ID is to start from the SharePoint ID and extend it. The benefit of this approach is that the item ID is always unique. Even if you create 10 items at the same time, they won’t compete about the ID, they’ll all get their own.

The downside is that this solution always needs two steps – to get the SharePoint ID you must create the item. ‘Create item’ the item, take the item ID output of that action, use it to create the actual ID and update it.

Power Automate custom id SP

You must also keep in mind that once a SharePoint ID is used it’s not available anymore in the list. For example, if you delete items from the list the IDs of those deleted items won’t be available anymore. You can easily create a hole in the ID sequence if you’re not careful.

With that in mind I’d say this is still the best solution. If you have just one custom ID sequence, you can use the IDs directly in the list. If you need more than one sequence you can create multiple ‘side’ lists, each of them used only to track the specific sequence. Create item in the side list, take its ID, and use it to create item in the main list.

Continue from the latest custom ID

The other approach, in case you use various custom IDs in a single list, is to search for the last ID so that you can increment it. Use the ‘Get items’ action with a filter and sorting to find the last item as already explained. Add 1 to the ID number and use it to create the item.

There’re a few things to be careful about as well though. Firstly, you’ll have to also check whether such ID was even used before. Secondly, you must extract the number from the ID to be able to increment it and turn it back into ID. And thirdly, the most serious issue – there’s a risk that the ID won’t be unique. If you create 10 items at once, they’ll all get the last item, increment its ID, and use it. For this reason you should always run only one such flow at a time.

That’s a bit too many potential problems and a reason why I’d avoid this approach.

Summary

When you need a unique, custom ID that’ll be created within your Power Automate flow, it’s a good idea to use the standard SP functionality. SharePoint will take care of any parallel requests for you, all you need is to create an item in some list, take the ID, and use it to create your custom ID. Unique number to which you just add the remaining characters.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Working on an Approval process?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy a fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes