I would like to create a flow to get sequential reference numbers but, I don´t want to use the Unique Identifier (ID). I already have a power automate flow using ID but as the ID is a read-online field, it cannot be modified so, when an entry from the SP list is deleted, the sequence numbers suffer a jump (e.g. 1,2,3,4,5, >> if the last entry is deleted, the number 5, in the next entry the flow will add a number 6 entry instead of overwriting number 5 so, I will get a jump in my sequence 1,2,3,4,6)

1 Answer 1


Conceptually: Find the item in the list with the highest reference number and increment that by 1.

Actions you can use for that

  • get list items - use the advanced setting to order the list by the reference number in descending order. Use the "Order by" field with <FieldName> desc.
  • with the First() function you can get the first item returned by the previous step, which, based on the sort order, should be the one with the highest reference number. You can use a variable with this expression:


MyItems is the name of the step I used to load the list. My column is called Reference.

  • Next, use an Increment Variable action to increment the variable, then use that in a new list item.

enter image description here

Here is the result

enter image description here

  • If that resolved your issue, please mark the answer as described in the tour. If it didn't, please leave a comment, so I can follow up.
    – teylyn
    Dec 20, 2022 at 20:06
  • How about if the item is deleted how this flow will again assign the number ? example 1,2,3,4,5 and if Row number 3 is deleted , the above flow will not reset as per what user is asking in the question.
    – Saira
    Dec 21, 2022 at 0:51
  • 1
    The OP talks about the LAST number getting deleted. The SharePoint ID will not repeat the deleted ID, but my approach will repeat the reference number if it was the last one. As asked for in the question.
    – teylyn
    Dec 21, 2022 at 11:11
  • Thanks a lot for this piece of knowledge!! really appreciated Feb 7, 2023 at 15:33
  • Please mark the answer as described in the tour. That is how you can say thank you around here.
    – teylyn
    Feb 8, 2023 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.