Power Automate increment number in SharePoint list

There will be times when you want to increment a number in a SharePoint list. This is easy using Power Automate. In this tutorial, I have explained with an example, “Power Automate increment number in SharePoint list“.

Here, I have explained how to increment a variable by 1 in Power Automate in a SharePoint list.

Business Scenario:

We were using a Microsoft Form that employees can submit for registration. Then, we had a SharePoint list where we wanted to store the registration details of the employees from the Microsoft Forms. Here, we wanted to auto-increment the number field type “OverallRegistrationCount” by 1 for each registration.

For this, I have created a SharePoint list having the following columns.

Column NameColumn Type
Employee IDdefault title column
Employee NameText column
RegisterForText column
OverallRegistrationCountNumber column
How to increment the number in the SharePoint list using Power Automate flow

I have also created a Microsoft form, i.e., Registration Form For Employees, which looks like the one below.

how to use increment variable in power automate

Now, we will start creating a flow to increment the number in the SharePoint list using Power Automate.

Increment the number in a SharePoint list using Power Automate

Let us see how to increment the variable by 1 in the SharePoint list using Power Automate,

In this example, I will show you how to auto-increment the number in the SharePoint list when a new submission occurs in Microsoft Forms using Power Automate.

Step-1:

Create an automated cloud flow with When a new response is submitted trigger. Select the Form ID from the dropdown. Here, I have selected the Registration Form For Employees.

power automate increment number in sharepoint list

Step-2:

See also  How to delete all rows in Excel using Power Automate?

Now select the initialize variable action, and initialize two variables i.e. MaxID, and Auto Increment, to store the maximum current value of the OverallRegistrationCount Field. Choose the variable type as Float and enter the value as 0.

power automate increment variable in apply to each

Step-3:

Add a new step and choose the Get response details action from action triggers to get the form responses. Provide the parameters below.

  • Form Id – Select the created form from the dropdown
  • Response Id – Choose from the dynamic content values
increment variable in power automate

Step-4:

Add a new step and choose the Create item action, to create a new item in SharePoint based on the Microsoft form responses. Configure the required parameters.

  • SiteAddress – select the SharePoint site address from the dropdown
  • List Name – choose the list name from the dropdown
  • Title – pass the EmployeeID form response from the dynamic content
  • EmployeeName – From the dynamic content, pass the EmployeeName form response
  • RegisterFor – Choose the form response RegisterFor value from the dynamic content
increment variable in power automate

Step-5:

Select the next step and choose the Get items action. Then, Provide the site address and name of your SharePoint list.

Then click on Show advanced options; in the OrderBy field, set the OverallRegistrationCount desc, to get the max number. Then set the Top Count value as 1, as highlighted below:

power automate increment variable by 1

Step-6:

To set the Max value for OverallRegistrationCount from the previous step, Add a new step and then select Set variable action.

From the dropdown, select the initialized variable (MaxID). In value, select OverallRegistrationCount from the dynamic content. It will automatically add the Apply to each action when we set the value.

increment variable power automate

Step-7:

See also  How to create multiple tabs form in Power Apps

Now we will add 1 to the variable i.e. MaxID + 1, and store the value into the initialized variable called Auto Increment.

So, click on the Next step and then select the Increment variable action, select the initialized variable name Auto Increment from the dropdown, and then set the value with the below expression:

add(variables('MaxID'),1)
sharepoint list increment number by 1

Step-8:

Now, we will update the OverallRegistrationCount value with the incremented value in the SharePoint list by using the update item action.

For that, select the Update item action and then provide the required parameters:

  • SiteAddress – select the SharePoint site address from the dropdown
  • List Name – choose the list name from the dropdown
  • Id– Select Id from the dynamic content value
  • Title – pass the Title from the dynamic content value

It will automatically add the Apply to each action. Then, set the OverallRegistrationCount with the Initialized variable (Auto Increment).

increment variable by 1 in power automate

Our complete flow looks like below:

increment variable by 1 using power automate

Save and test the flow. Here, I have filled out the Microsoft form and clicked the Submit button.

power automate auto increment number

The flow triggers when the response is submitted. Once the flow runs successfully, like below:

power automate increment variable by 1

We can see it creates a new item and increments the OverallRegistrationCount by 1 in the SharePoint list using Power Automate flow.

power automate increment number in sharepoint list

Conclusion

I hope you get an idea of the auto-increment number in the SharePoint list using Power Automate flow. Here, I have shown you an example of incrementing a column value by 1 in the SharePoint list when a new submission occurs in Microsoft Forms using Power Automate flow. This is how to increment a number in a sharepoint list using Power Automate.

See also  Microsoft flow send email based on create date

You may also like:

>