How to Auto Generate Serial Number in Power Automate?

A few days before, I was required to send an email containing project names and serial numbers. To achieve this, I used the range() function in Power Automate, which generates an array of integers.

In this tutorial, I will explain how to provide a sequential serial number for a list of SharePoint items using the Power Automate range() function, along with an example.

Power Automate range() Function

The Power Automate range() function will generate the sequential range of integers that starts from the start index to the count.

In simple terms, we can tell it will return an array of integers that start from a specific integer.

Syntax: range([Start Index:Integer],[Count:Integer])

Parameters:

  • Start Index: An integer value that starts the array as the first item
  • Count: The number of integers in the array.

Example: range(1,5) => Returns output [1, 2, 3, 4,5]

Note: The count parameter value must be a positive integer that doesn't exceed 100,000.

Example:- Power Automate to Generate a Sequence Serial Number

In this example, I will explain how to automate serial number generation without a loop inside flows.

Scenario: I have a Project list with the Project Name, as you can see in the attached screenshot below. My requirement is to send an email about Project Names along with the serial number of each project.

Serial Number Generation in Power Automate

Follow the step-by-step guide:

1. In the Power Automate Home page, Select Instant cloud flow -> Add Manually trigger a flow trigger.

2. To fetch the Project Names from the SharePoint list, add the Get items action and provide the Site Address and List Name.

Power Automate Generate Sequential Serial Number

3. Next, add Create HTML table to get the range values from the SharePoint list.

  • From: Add the code below.
range(0,length(outputs('Get_items')?['body/value']))

Click on Advanced Parameters to display all the options.

Columns: Select the Custom option from the drop-down.

HeaderValue
S.NOadd(1,item())
Project Nameoutputs(‘Get_items’)?[‘body/value’][item()]?[‘ProjectName’]
Auto Generate Serial Number in Power Automate

4. Add a Send an email(v2) action with the required parameters like ToSubject, and Body to send an email.

Power Automate automatically generate serial number

Once the flow is done, save and run the flow manually.

Result:

Power Automate auto generate sequence number

Conclusion

I hope you now understand how to generate the sequence serial numbers in a Power Automate flow using the range() function.

You can also check out:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…