Forum Discussion

Rob_Elliott's avatar
Rob_Elliott
Bronze Contributor
Aug 15, 2025

Re: Automated Lists numbering in PowerAutomate

W_AT_H​ an alternative way to do this is shown below. The current maximum number is 232 and the expected new maximum number is 233. As you'll see, the flow runs successfully and creates the new item with the correct number.

The CountryID is a number column.

To get the current maximum number sort the list by CountryID descending and just bring back the top 1:

Add an apply to each and add a compose with the expression int(item()?['CountryID']). Set the variable you initialized earlier with the outputs of the compose: Then add an increment variable action and set it to increment by 1.

Use the variable  for the CountryID of the new list item.

This is the result.

 

Rob
Los Gallardos
Microsoft Power Automate Community Super User.
Principal Consultant, SharePoint and Power Platform WSP Global (and classic 1967 Morris Traveller driver)

  • W_AT_H's avatar
    W_AT_H
    Copper Contributor

    Hi Rob,
    Working witht he variables eventually solved it. That was some great advice. Thank you very much.

    Weirdly I had to set the variable to float at initialize step. Otherwise it would keep failing. Still, solved and happy.

    - Stef

Resources